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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
609ff3d8
Commit
609ff3d8
authored
Oct 15, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correctly handle PyCFunctions with METH_FASTCALL signature in Py3.6
parent
7ead0303
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+6
-0
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+7
-3
No files found.
Cython/Utility/ModuleSetupCode.c
View file @
609ff3d8
...
@@ -188,6 +188,12 @@
...
@@ -188,6 +188,12 @@
#ifndef Py_TPFLAGS_HAVE_FINALIZE
#ifndef Py_TPFLAGS_HAVE_FINALIZE
#define Py_TPFLAGS_HAVE_FINALIZE 0
#define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#endif
#ifndef METH_FASTCALL
// new in CPython 3.6
#define METH_FASTCALL 0x80
typedef
PyObject
*
(
*
_PyCFunctionFast
)
(
PyObject
*
self
,
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
);
#endif
/* new Py3.3 unicode type (PEP 393) */
/* new Py3.3 unicode type (PEP 393) */
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
...
...
Cython/Utility/ObjectHandling.c
View file @
609ff3d8
...
@@ -1126,7 +1126,7 @@ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
...
@@ -1126,7 +1126,7 @@ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
{
{
PyMethodDescrObject
*
descr
=
(
PyMethodDescrObject
*
)
method
;
PyMethodDescrObject
*
descr
=
(
PyMethodDescrObject
*
)
method
;
target
->
func
=
descr
->
d_method
->
ml_meth
;
target
->
func
=
descr
->
d_method
->
ml_meth
;
target
->
flag
=
descr
->
d_method
->
ml_flags
&
(
METH_VARARGS
|
METH_KEYWORDS
|
METH_O
|
METH_NOARGS
);
target
->
flag
=
descr
->
d_method
->
ml_flags
&
~
(
METH_CLASS
|
METH_STATIC
|
METH_COEXIST
);
}
}
#endif
#endif
return
0
;
return
0
;
...
@@ -1142,7 +1142,9 @@ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObje
...
@@ -1142,7 +1142,9 @@ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObje
((likely((cfunc)->func)) ? \
((likely((cfunc)->func)) ? \
(likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) : \
(likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) : \
(likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, $empty_tuple, NULL)) : \
(likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, $empty_tuple, NULL)) : \
((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, $empty_tuple) : __Pyx__CallUnboundCMethod0(cfunc, self)))) : \
((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, $empty_tuple) : \
(PY_VERSION_HEX >= 0x030600B1 && (cfunc)->flag == METH_FASTCALL ? (*(_PyCFunctionFast)(cfunc)->func)(self, &PyTuple_GET_ITEM($empty_tuple, 0), 0, NULL) : \
__Pyx__CallUnboundCMethod0(cfunc, self))))) : \
__Pyx__CallUnboundCMethod0(cfunc, self))
__Pyx__CallUnboundCMethod0(cfunc, self))
#else
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
...
@@ -1178,7 +1180,9 @@ static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObje
...
@@ -1178,7 +1180,9 @@ static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObje
#if CYTHON_COMPILING_IN_CPYTHON
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) \
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) \
((likely((cfunc)->func && (cfunc)->flag == METH_O)) ? (*((cfunc)->func))(self, arg) : \
((likely((cfunc)->func && (cfunc)->flag == METH_O)) ? (*((cfunc)->func))(self, arg) : \
__Pyx__CallUnboundCMethod1(cfunc, self, arg))
((PY_VERSION_HEX >= 0x030600B1 && (cfunc)->func && (cfunc)->flag == METH_FASTCALL) ?
(
*
(
_PyCFunctionFast
)(
cfunc
)
->
func
)(
self
,
&
arg
,
1
,
NULL
)
:
\
__Pyx__CallUnboundCMethod1
(
cfunc
,
self
,
arg
)))
#else
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#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