]>
Commit | Line | Data |
---|---|---|
7028aee6 JP |
1 | From 71c81741495cdce132b6f45a0f596d70909c1e4d Mon Sep 17 00:00:00 2001 |
2 | From: Christoph Reiter <reiter.christoph@gmail.com> | |
3 | Date: Sat, 15 Jun 2019 16:07:00 +0200 | |
4 | Subject: [PATCH] enum: explicitely set enum.__str__ | |
5 | ||
6 | Python 3.8 has removed the int.__str__ implementation. So we don't fall | |
7 | back to object.__str__ and thus enum.__repr__ set __str__ to int.__repr__ | |
8 | instead. This gives us the same behaviour with all python versions. | |
9 | ||
10 | See https://github.com/python/cpython/commit/96aeaec64738b730 | |
11 | --- | |
12 | cairo/enums.c | 1 + | |
13 | 1 file changed, 1 insertion(+) | |
14 | ||
15 | diff --git a/cairo/enums.c b/cairo/enums.c | |
16 | index 08fbaf3..4273232 100644 | |
17 | --- a/cairo/enums.c | |
18 | +++ b/cairo/enums.c | |
19 | @@ -257,6 +257,7 @@ init_enums (PyObject *module) { | |
20 | PyObject *ev; | |
21 | ||
22 | Pycairo_IntEnum_Type.tp_repr = (reprfunc)int_enum_repr; | |
23 | + Pycairo_IntEnum_Type.tp_str = PYCAIRO_PyLong_Type.tp_repr; | |
24 | Pycairo_IntEnum_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; | |
25 | Pycairo_IntEnum_Type.tp_methods = int_enum_methods; | |
26 | Pycairo_IntEnum_Type.tp_base = &PYCAIRO_PyLong_Type; |