summaryrefslogtreecommitdiff
path: root/dev-python/ruamel-yaml-clib/files/ruamel-yaml-clib-0.2.2-python3_10.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/ruamel-yaml-clib/files/ruamel-yaml-clib-0.2.2-python3_10.patch')
-rw-r--r--dev-python/ruamel-yaml-clib/files/ruamel-yaml-clib-0.2.2-python3_10.patch45
1 files changed, 45 insertions, 0 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 */