summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2021-05-13 19:56:37 +0200
committerMarek Szuba <marecki@gentoo.org>2021-05-13 21:09:00 +0200
commitd6ddb6b57d4d6b16ab5acd4200558245cd7fb143 (patch)
tree6ff4b9c62a32cbcfa00faa232f3aa74da1284312 /dev-python/ruamel-yaml-clib
parentdev-python/namespace-ruamel: support python3_10 (diff)
downloadgentoo-d6ddb6b57d4d6b16ab5acd4200558245cd7fb143.tar.gz
gentoo-d6ddb6b57d4d6b16ab5acd4200558245cd7fb143.tar.bz2
gentoo-d6ddb6b57d4d6b16ab5acd4200558245cd7fb143.zip
dev-python/ruamel-yaml-clib: support python3_10
A small change was needed for the source file _ruamel_yaml.c to compile against this version, that said with the fix in place builds and installs fine under all CPython versions currently in PYTHON_COMPAT, several deprecation warnings notwithstanding. No standalone test suite but all relevant tests from dev-python/ruamel-yaml pass. Nb. the aforementioned source file is cython-generated so it should be simple enough for upstream to bring up to date. Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'dev-python/ruamel-yaml-clib')
-rw-r--r--dev-python/ruamel-yaml-clib/files/ruamel-yaml-clib-0.2.2-python3_10.patch45
-rw-r--r--dev-python/ruamel-yaml-clib/ruamel-yaml-clib-0.2.2-r1.ebuild6
2 files changed, 49 insertions, 2 deletions
diff --git a/dev-python/ruamel-yaml-clib/files/ruamel-yaml-clib-0.2.2-python3_10.patch b/dev-python/ruamel-yaml-clib/files/ruamel-yaml-clib-0.2.2-python3_10.patch
new file mode 100644
index 000000000000..6a34420de79f
--- /dev/null
+++ b/dev-python/ruamel-yaml-clib/files/ruamel-yaml-clib-0.2.2-python3_10.patch
@@ -0,0 +1,45 @@
+Since Python 3.10, Py_REFCNT() can no longer be used as an l-value. See
+
+https://docs.python.org/3.10/whatsnew/3.10.html#id2
+
+for details.
+
+--- a/_ruamel_yaml.c
++++ b/_ruamel_yaml.c
+@@ -23877,9 +23877,9 @@
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+- ++Py_REFCNT(o);
++ Py_SET_REFCNT(o, Py_REFCNT(o) + 1);
+ __pyx_pw_12_ruamel_yaml_7CParser_3__dealloc__(o);
+- --Py_REFCNT(o);
++ Py_SET_REFCNT(o, Py_REFCNT(o) - 1);
+ PyErr_Restore(etype, eval, etb);
+ }
+ Py_CLEAR(p->stream);
+@@ -24050,9 +24050,9 @@
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+- ++Py_REFCNT(o);
++ Py_SET_REFCNT(o, Py_REFCNT(o) + 1);
+ __pyx_pw_12_ruamel_yaml_8CEmitter_3__dealloc__(o);
+- --Py_REFCNT(o);
++ Py_SET_REFCNT(o, Py_REFCNT(o) - 1);
+ PyErr_Restore(etype, eval, etb);
+ }
+ Py_CLEAR(p->stream);
+--- a/_ruamel_yaml.h
++++ b/_ruamel_yaml.h
+@@ -12,6 +12,10 @@
+ #define PyString_GET_SIZE PyBytes_GET_SIZE
+ #define PyString_FromStringAndSize PyBytes_FromStringAndSize
+
++#if PY_VERSION_HEX < 0x030900A4
++# define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)
++#endif
++
+ #endif
+
+ #ifdef _MSC_VER /* MS Visual C++ 6.0 */
diff --git a/dev-python/ruamel-yaml-clib/ruamel-yaml-clib-0.2.2-r1.ebuild b/dev-python/ruamel-yaml-clib/ruamel-yaml-clib-0.2.2-r1.ebuild
index bfbba4a4408d..7604a87fdc33 100644
--- a/dev-python/ruamel-yaml-clib/ruamel-yaml-clib-0.2.2-r1.ebuild
+++ b/dev-python/ruamel-yaml-clib/ruamel-yaml-clib-0.2.2-r1.ebuild
@@ -3,7 +3,7 @@
EAPI=7
-PYTHON_COMPAT=( pypy3 python3_{7..9} )
+PYTHON_COMPAT=( pypy3 python3_{7..10} )
inherit distutils-r1
@@ -18,7 +18,9 @@ LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ppc ppc64 sparc x86"
-RDEPEND="!<dev-python/ruamel-yaml-0.16.0"
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.2.2-python3_10.patch
+)
S="${WORKDIR}"/${MY_P}