Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
09979e15
Commit
09979e15
authored
Jun 04, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify classmethod() code in Py3 where "PyMethodDescr_Type" is directly available.
parent
8359cf76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
Cython/Utility/CythonFunction.c
Cython/Utility/CythonFunction.c
+5
-1
No files found.
Cython/Utility/CythonFunction.c
View file @
09979e15
...
@@ -1292,7 +1292,8 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
...
@@ -1292,7 +1292,8 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
// special C-API function only in Pyston and PyPy >= 5.9
// special C-API function only in Pyston and PyPy >= 5.9
if
(
PyMethodDescr_Check
(
method
))
if
(
PyMethodDescr_Check
(
method
))
#else
#else
// It appears that PyMethodDescr_Type is not exposed anywhere in the CPython C-API
#if PY_MAJOR_VERSION == 2
// PyMethodDescr_Type is not exposed in the CPython C-API in Py2.
static
PyTypeObject
*
methoddescr_type
=
NULL
;
static
PyTypeObject
*
methoddescr_type
=
NULL
;
if
(
methoddescr_type
==
NULL
)
{
if
(
methoddescr_type
==
NULL
)
{
PyObject
*
meth
=
PyObject_GetAttrString
((
PyObject
*
)
&
PyList_Type
,
"append"
);
PyObject
*
meth
=
PyObject_GetAttrString
((
PyObject
*
)
&
PyList_Type
,
"append"
);
...
@@ -1300,6 +1301,9 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
...
@@ -1300,6 +1301,9 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
methoddescr_type
=
Py_TYPE
(
meth
);
methoddescr_type
=
Py_TYPE
(
meth
);
Py_DECREF
(
meth
);
Py_DECREF
(
meth
);
}
}
#else
PyTypeObject
*
methoddescr_type
=
&
PyMethodDescr_Type
;
#endif
if
(
__Pyx_TypeCheck
(
method
,
methoddescr_type
))
if
(
__Pyx_TypeCheck
(
method
,
methoddescr_type
))
#endif
#endif
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment