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
0b0a2e57
Commit
0b0a2e57
authored
Jul 26, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a dedicated macro to guard calls to _PyType_Lookup()
parent
8ff66d8c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
Cython/Utility/ExtensionTypes.c
Cython/Utility/ExtensionTypes.c
+3
-3
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+11
-0
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+1
-2
No files found.
Cython/Utility/ExtensionTypes.c
View file @
0b0a2e57
...
@@ -90,13 +90,13 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
...
@@ -90,13 +90,13 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
PyObject
*
setstate
=
NULL
;
PyObject
*
setstate
=
NULL
;
PyObject
*
setstate_cython
=
NULL
;
PyObject
*
setstate_cython
=
NULL
;
#if CYTHON_
COMPILING_IN_CPYTHON
#if CYTHON_
USE_PYTYPE_LOOKUP
if
(
_PyType_Lookup
((
PyTypeObject
*
)
type_obj
,
PYIDENT
(
"__getstate__"
)))
goto
GOOD
;
if
(
_PyType_Lookup
((
PyTypeObject
*
)
type_obj
,
PYIDENT
(
"__getstate__"
)))
goto
GOOD
;
#else
#else
if
(
PyObject_HasAttr
(
type_obj
,
PYIDENT
(
"__getstate__"
)))
goto
GOOD
;
if
(
PyObject_HasAttr
(
type_obj
,
PYIDENT
(
"__getstate__"
)))
goto
GOOD
;
#endif
#endif
#if CYTHON_
COMPILING_IN_CPYTHON
#if CYTHON_
USE_PYTYPE_LOOKUP
object_reduce_ex
=
_PyType_Lookup
(
&
PyBaseObject_Type
,
PYIDENT
(
"__reduce_ex__"
));
if
(
!
object_reduce_ex
)
goto
BAD
;
object_reduce_ex
=
_PyType_Lookup
(
&
PyBaseObject_Type
,
PYIDENT
(
"__reduce_ex__"
));
if
(
!
object_reduce_ex
)
goto
BAD
;
#else
#else
object_reduce_ex
=
__Pyx_PyObject_GetAttrStr
((
PyObject
*
)
&
PyBaseObject_Type
,
PYIDENT
(
"__reduce_ex__"
));
if
(
!
object_reduce_ex
)
goto
BAD
;
object_reduce_ex
=
__Pyx_PyObject_GetAttrStr
((
PyObject
*
)
&
PyBaseObject_Type
,
PYIDENT
(
"__reduce_ex__"
));
if
(
!
object_reduce_ex
)
goto
BAD
;
...
@@ -105,7 +105,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
...
@@ -105,7 +105,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
reduce_ex
=
__Pyx_PyObject_GetAttrStr
(
type_obj
,
PYIDENT
(
"__reduce_ex__"
));
if
(
unlikely
(
!
reduce_ex
))
goto
BAD
;
reduce_ex
=
__Pyx_PyObject_GetAttrStr
(
type_obj
,
PYIDENT
(
"__reduce_ex__"
));
if
(
unlikely
(
!
reduce_ex
))
goto
BAD
;
if
(
reduce_ex
==
object_reduce_ex
)
{
if
(
reduce_ex
==
object_reduce_ex
)
{
#if CYTHON_
COMPILING_IN_CPYTHON
#if CYTHON_
USE_PYTYPE_LOOKUP
object_reduce
=
_PyType_Lookup
(
&
PyBaseObject_Type
,
PYIDENT
(
"__reduce__"
));
if
(
!
object_reduce
)
goto
BAD
;
object_reduce
=
_PyType_Lookup
(
&
PyBaseObject_Type
,
PYIDENT
(
"__reduce__"
));
if
(
!
object_reduce
)
goto
BAD
;
#else
#else
object_reduce
=
__Pyx_PyObject_GetAttrStr
((
PyObject
*
)
&
PyBaseObject_Type
,
PYIDENT
(
"__reduce__"
));
if
(
!
object_reduce
)
goto
BAD
;
object_reduce
=
__Pyx_PyObject_GetAttrStr
((
PyObject
*
)
&
PyBaseObject_Type
,
PYIDENT
(
"__reduce__"
));
if
(
!
object_reduce
)
goto
BAD
;
...
...
Cython/Utility/ModuleSetupCode.c
View file @
0b0a2e57
...
@@ -49,6 +49,8 @@
...
@@ -49,6 +49,8 @@
#undef CYTHON_USE_TYPE_SLOTS
#undef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 0
#define CYTHON_USE_TYPE_SLOTS 0
#undef CYTHON_USE_PYTYPE_LOOKUP
#define CYTHON_USE_PYTYPE_LOOKUP 0
#undef CYTHON_USE_ASYNC_SLOTS
#undef CYTHON_USE_ASYNC_SLOTS
#define CYTHON_USE_ASYNC_SLOTS 0
#define CYTHON_USE_ASYNC_SLOTS 0
#undef CYTHON_USE_PYLIST_INTERNALS
#undef CYTHON_USE_PYLIST_INTERNALS
...
@@ -78,6 +80,8 @@
...
@@ -78,6 +80,8 @@
#ifndef CYTHON_USE_TYPE_SLOTS
#ifndef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 1
#define CYTHON_USE_TYPE_SLOTS 1
#endif
#endif
#undef CYTHON_USE_PYTYPE_LOOKUP
#define CYTHON_USE_PYTYPE_LOOKUP 0
#undef CYTHON_USE_ASYNC_SLOTS
#undef CYTHON_USE_ASYNC_SLOTS
#define CYTHON_USE_ASYNC_SLOTS 0
#define CYTHON_USE_ASYNC_SLOTS 0
#undef CYTHON_USE_PYLIST_INTERNALS
#undef CYTHON_USE_PYLIST_INTERNALS
...
@@ -111,6 +115,13 @@
...
@@ -111,6 +115,13 @@
#ifndef CYTHON_USE_TYPE_SLOTS
#ifndef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 1
#define CYTHON_USE_TYPE_SLOTS 1
#endif
#endif
#if PY_VERSION_HEX < 0x02070000
// looks like calling _PyType_Lookup() isn't safe in Py<=2.6/3.1
#undef CYTHON_USE_PYTYPE_LOOKUP
#define CYTHON_USE_PYTYPE_LOOKUP 0
#elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
#define CYTHON_USE_PYTYPE_LOOKUP 1
#endif
#if PY_MAJOR_VERSION < 3
#if PY_MAJOR_VERSION < 3
#undef CYTHON_USE_ASYNC_SLOTS
#undef CYTHON_USE_ASYNC_SLOTS
#define CYTHON_USE_ASYNC_SLOTS 0
#define CYTHON_USE_ASYNC_SLOTS 0
...
...
Cython/Utility/ObjectHandling.c
View file @
0b0a2e57
...
@@ -1036,8 +1036,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
...
@@ -1036,8 +1036,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
/////////////// PyObjectLookupSpecial.proto ///////////////
/////////////// PyObjectLookupSpecial.proto ///////////////
//@requires: PyObjectGetAttrStr
//@requires: PyObjectGetAttrStr
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
// looks like calling _PyType_Lookup() isn't safe in Py<=2.6/3.1
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_LookupSpecial
(
PyObject
*
obj
,
PyObject
*
attr_name
)
{
static
CYTHON_INLINE
PyObject
*
__Pyx_PyObject_LookupSpecial
(
PyObject
*
obj
,
PyObject
*
attr_name
)
{
PyObject
*
res
;
PyObject
*
res
;
PyTypeObject
*
tp
=
Py_TYPE
(
obj
);
PyTypeObject
*
tp
=
Py_TYPE
(
obj
);
...
...
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