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
Kirill Smelkov
cython
Commits
84d6bd15
Commit
84d6bd15
authored
Jun 05, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adapt METH_FASTCALL handling to signature change of _PyCFunctionFast() in Py3.7
parent
a4fb856a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
+25
-10
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+11
-6
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+14
-4
No files found.
Cython/Utility/ModuleSetupCode.c
View file @
84d6bd15
...
@@ -196,17 +196,22 @@
...
@@ -196,17 +196,22 @@
#define Py_TPFLAGS_HAVE_FINALIZE 0
#define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#endif
#ifndef METH_FASTCALL
#if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL)
// new in CPython 3.6
// new in CPython 3.6, but changed in 3.7
#define METH_FASTCALL 0x80
#ifndef METH_FASTCALL
typedef
PyObject
*
(
*
__Pyx_PyCFunctionFast
)
(
PyObject
*
self
,
PyObject
**
args
,
#define METH_FASTCALL 0x80
Py_ssize_t
nargs
,
PyObject
*
kwnames
);
#endif
typedef
PyObject
*
(
*
__Pyx_PyCFunctionFast
)
(
PyObject
*
self
,
PyObject
**
args
,
Py_ssize_t
nargs
);
// new in CPython 3.7, used to be old signature of _PyCFunctionFast() in 3.6
typedef
PyObject
*
(
*
__Pyx_PyCFunctionFastWithKeywords
)
(
PyObject
*
self
,
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
);
#else
#else
#define __Pyx_PyCFunctionFast _PyCFunctionFast
#define __Pyx_PyCFunctionFast _PyCFunctionFast
#define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#endif
#if CYTHON_FAST_PYCCALL
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func) \
#define __Pyx_PyFastCFunction_Check(func) \
((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST
| METH_KEYWORDS
)))))
#else
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#endif
...
...
Cython/Utility/ObjectHandling.c
View file @
84d6bd15
...
@@ -1146,8 +1146,13 @@ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObje
...
@@ -1146,8 +1146,13 @@ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObje
(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) : \
((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, $empty_tuple) : \
(PY_VERSION_HEX >= 0x030600B1 && (cfunc)->flag == METH_FASTCALL ? (*(__Pyx_PyCFunctionFast)(cfunc)->func)(self, &PyTuple_GET_ITEM($empty_tuple, 0), 0, NULL) : \
(PY_VERSION_HEX >= 0x030600B1 && (cfunc)->flag == METH_FASTCALL ? \
__Pyx__CallUnboundCMethod0(cfunc, self))))) : \
(PY_VERSION_HEX >= 0x030700A0 ? \
(*(__Pyx_PyCFunctionFast)(cfunc)->func)(self, &PyTuple_GET_ITEM($empty_tuple, 0), 0) : \
(*(__Pyx_PyCFunctionFastWithKeywords)(cfunc)->func)(self, &PyTuple_GET_ITEM($empty_tuple, 0), 0, NULL)) : \
(PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ? \
(*(__Pyx_PyCFunctionFastWithKeywords)(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)
...
@@ -1642,9 +1647,10 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P
...
@@ -1642,9 +1647,10 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P
PyCFunctionObject
*
func
=
(
PyCFunctionObject
*
)
func_obj
;
PyCFunctionObject
*
func
=
(
PyCFunctionObject
*
)
func_obj
;
PyCFunction
meth
=
PyCFunction_GET_FUNCTION
(
func
);
PyCFunction
meth
=
PyCFunction_GET_FUNCTION
(
func
);
PyObject
*
self
=
PyCFunction_GET_SELF
(
func
);
PyObject
*
self
=
PyCFunction_GET_SELF
(
func
);
int
flags
=
PyCFunction_GET_FLAGS
(
func
);
assert
(
PyCFunction_Check
(
func
));
assert
(
PyCFunction_Check
(
func
));
assert
(
METH_FASTCALL
==
(
PyCFunction_GET_FLAGS
(
func
)
&
~
(
METH_CLASS
|
METH_STATIC
|
METH_COEXIST
)));
assert
(
METH_FASTCALL
==
(
flags
&
~
(
METH_CLASS
|
METH_STATIC
|
METH_COEXIST
|
METH_KEYWORDS
)));
assert
(
nargs
>=
0
);
assert
(
nargs
>=
0
);
assert
(
nargs
==
0
||
args
!=
NULL
);
assert
(
nargs
==
0
||
args
!=
NULL
);
...
@@ -1653,7 +1659,11 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P
...
@@ -1653,7 +1659,11 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P
caller loses its exception */
caller loses its exception */
assert
(
!
PyErr_Occurred
());
assert
(
!
PyErr_Occurred
());
return
(
*
((
__Pyx_PyCFunctionFast
)
meth
))
(
self
,
args
,
nargs
,
NULL
);
if
((
PY_VERSION_HEX
<
0x030700A0
)
||
unlikely
(
flags
&
METH_KEYWORDS
))
{
return
(
*
((
__Pyx_PyCFunctionFastWithKeywords
)
meth
))
(
self
,
args
,
nargs
,
NULL
);
}
else
{
return
(
*
((
__Pyx_PyCFunctionFast
)
meth
))
(
self
,
args
,
nargs
);
}
}
}
#endif
/* CYTHON_FAST_PYCCALL */
#endif
/* CYTHON_FAST_PYCCALL */
...
...
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