enum: explicitely set enum.__str__

Python 3.8 has removed the int.__str__ implementation. So we don't fall
back to object.__str__ and thus enum.__repr__ set __str__ to int.__repr__
instead. This gives us the same behaviour with all python versions.

See https://github.com/python/cpython/commit/96aeaec64738b730
This commit is contained in:
Christoph Reiter 2019-06-15 16:07:00 +02:00
parent 7c3a71d1de
commit 98fa2aed65
1 changed files with 1 additions and 0 deletions

View File

@ -257,6 +257,7 @@ init_enums (PyObject *module) {
PyObject *ev;
Pycairo_IntEnum_Type.tp_repr = (reprfunc)int_enum_repr;
Pycairo_IntEnum_Type.tp_str = PYCAIRO_PyLong_Type.tp_repr;
Pycairo_IntEnum_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE;
Pycairo_IntEnum_Type.tp_methods = int_enum_methods;
Pycairo_IntEnum_Type.tp_base = &PYCAIRO_PyLong_Type;