diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-06-14 11:17:19 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-06-14 11:31:50 +0200 |
commit | 14b141814617fb383f7caa03399ffef34dc0945d (patch) | |
tree | 057f030439bd32842fda9c2d2bf67efdc03818be /dev-python/cython/files | |
parent | www-apps/baikal-0.7.1: version bump (diff) | |
download | gentoo-14b141814617fb383f7caa03399ffef34dc0945d.tar.gz gentoo-14b141814617fb383f7caa03399ffef34dc0945d.tar.bz2 gentoo-14b141814617fb383f7caa03399ffef34dc0945d.zip |
dev-python/cython: Backport py3.9 classmethod fix
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/cython/files')
-rw-r--r-- | dev-python/cython/files/cython-0.29.20-py39-classmeth.patch | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/dev-python/cython/files/cython-0.29.20-py39-classmeth.patch b/dev-python/cython/files/cython-0.29.20-py39-classmeth.patch new file mode 100644 index 000000000000..e82982472e82 --- /dev/null +++ b/dev-python/cython/files/cython-0.29.20-py39-classmeth.patch @@ -0,0 +1,59 @@ +From 1bb26b964060392ecb08c3b6c8ca4626e5c1eec7 Mon Sep 17 00:00:00 2001 +From: Jeroen Demeyer <jeroen.k.demeyer@gmail.com> +Date: Wed, 28 Aug 2019 10:56:28 +0200 +Subject: [PATCH] Always bind Cython functions + +--- + Cython/Utility/CythonFunction.c | 15 --------------- + tests/run/cyfunction.pyx | 12 ++++++++++++ + 2 files changed, 12 insertions(+), 15 deletions(-) + +diff --git a/Cython/Utility/CythonFunction.c b/Cython/Utility/CythonFunction.c +index 01ff1e0dd4..0758548cb3 100644 +--- a/Cython/Utility/CythonFunction.c ++++ b/Cython/Utility/CythonFunction.c +@@ -552,21 +552,6 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, + + static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) + { +- __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; +- +- if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { +- Py_INCREF(func); +- return func; +- } +- +- if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { +- if (type == NULL) +- type = (PyObject *)(Py_TYPE(obj)); +- return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); +- } +- +- if (obj == Py_None) +- obj = NULL; + return __Pyx_PyMethod_New(func, obj, type); + } + +diff --git a/tests/run/cyfunction.pyx b/tests/run/cyfunction.pyx +index cbce48bcfc..bbd2cefb83 100644 +--- a/tests/run/cyfunction.pyx ++++ b/tests/run/cyfunction.pyx +@@ -376,6 +376,18 @@ class TestUnboundMethod: + def meth(self): pass + + ++class TestStaticmethod(object): ++ """ ++ >>> x = TestStaticmethod() ++ >>> x.staticmeth(42) ++ 42 ++ >>> x.staticmeth.__get__(42)() ++ 42 ++ """ ++ @staticmethod ++ def staticmeth(arg): return arg ++ ++ + cdef class TestOptimisedBuiltinMethod: + """ + >>> obj = TestOptimisedBuiltinMethod() |