Python 3.8 support

https://bugzilla.redhat.com/show_bug.cgi?id=1717658
71c8174149
This commit is contained in:
Miro Hrončok 2019-06-20 08:17:52 +02:00
parent 6a36e629ba
commit 1c35e7acff
2 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From 71c81741495cdce132b6f45a0f596d70909c1e4d Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sat, 15 Jun 2019 16:07:00 +0200
Subject: [PATCH] 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
---
cairo/enums.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/cairo/enums.c b/cairo/enums.c
index 08fbaf3..4273232 100644
--- a/cairo/enums.c
+++ b/cairo/enums.c
@@ -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;

View File

@ -7,6 +7,9 @@ License: MPLv1.1 or LGPLv2
URL: http://cairographics.org/pycairo
Source0: https://github.com/pygobject/pycairo/releases/download/v%{version}/pycairo-%{version}.tar.gz
# Python 3.8 support
Patch0: https://github.com/pygobject/pycairo/commit/71c81741495cdce132b6f45a0f596d70909c1e4d.patch
BuildRequires: cairo-devel
BuildRequires: gcc
BuildRequires: pkgconfig
@ -59,7 +62,7 @@ This package contains files required to build wrappers for cairo add-on
libraries so that they interoperate with py3cairo.
%prep
%setup -q
%autosetup -p1
%build
%py2_build