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
9b3dd8ec
Commit
9b3dd8ec
authored
Jun 15, 2017
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Less attribute lookups in reduce patching.
parent
f8b3405e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
10 deletions
+5
-10
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+2
-0
Cython/Utility/ExtensionTypes.c
Cython/Utility/ExtensionTypes.c
+3
-10
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
9b3dd8ec
...
@@ -1589,6 +1589,8 @@ if VALUE is not None:
...
@@ -1589,6 +1589,8 @@ if VALUE is not None:
if
inherited_reduce
:
if
inherited_reduce
:
# This is not failsafe, as we may not know whether a cimported class defines a __reduce__.
# This is not failsafe, as we may not know whether a cimported class defines a __reduce__.
# This is why we define __reduce_cython__ and only replace __reduce__
# (via ExtensionTypes.SetupReduce utility code) at runtime on class creation.
return
return
non_py
=
[
non_py
=
[
...
...
Cython/Utility/ExtensionTypes.c
View file @
9b3dd8ec
...
@@ -68,9 +68,6 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
...
@@ -68,9 +68,6 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
PyObject
*
reduce
=
NULL
;
PyObject
*
reduce
=
NULL
;
PyObject
*
reduce_ex
=
NULL
;
PyObject
*
reduce_ex
=
NULL
;
PyObject
*
reduce_cython
=
NULL
;
PyObject
*
reduce_cython
=
NULL
;
PyObject
*
reduce_name
=
NULL
;
PyObject
*
reduce_cython_name
=
NULL
;
PyObject
*
same_name
=
NULL
;
if
(
object_reduce_ex
==
NULL
)
{
if
(
object_reduce_ex
==
NULL
)
{
__Pyx_setup_reduce_GET_ATTR_OR_BAD
(
builtin_object
,
__pyx_b
,
"object"
);
__Pyx_setup_reduce_GET_ATTR_OR_BAD
(
builtin_object
,
__pyx_b
,
"object"
);
...
@@ -82,10 +79,9 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
...
@@ -82,10 +79,9 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
if
(
reduce_ex
==
object_reduce_ex
)
{
if
(
reduce_ex
==
object_reduce_ex
)
{
__Pyx_setup_reduce_GET_ATTR_OR_BAD
(
reduce
,
type_obj
,
"__reduce__"
);
__Pyx_setup_reduce_GET_ATTR_OR_BAD
(
reduce
,
type_obj
,
"__reduce__"
);
__Pyx_setup_reduce_GET_ATTR_OR_BAD
(
reduce_cython
,
type_obj
,
"__reduce_cython__"
);
__Pyx_setup_reduce_GET_ATTR_OR_BAD
(
reduce_cython
,
type_obj
,
"__reduce_cython__"
);
__Pyx_setup_reduce_GET_ATTR_OR_BAD
(
reduce_name
,
reduce
,
"__name__"
);
if
(
object_reduce
==
reduce
__Pyx_setup_reduce_GET_ATTR_OR_BAD
(
reduce_cython_name
,
reduce_cython
,
"__name__"
);
||
(
strcmp
(
reduce
->
ob_type
->
tp_name
,
"method_descriptor"
)
==
0
same_name
=
PyObject_RichCompare
(
reduce_name
,
reduce_cython_name
,
Py_EQ
);
if
(
same_name
==
NULL
)
goto
BAD
;
&&
strcmp
(((
PyMethodDescrObject
*
)
reduce
)
->
d_method
->
ml_name
,
"__reduce_cython__"
)
==
0
))
{
if
(
object_reduce
==
reduce
||
PyObject_IsTrue
(
same_name
))
{
ret
=
PyDict_SetItemString
(((
PyTypeObject
*
)
type_obj
)
->
tp_dict
,
"__reduce__"
,
reduce_cython
);
if
(
ret
<
0
)
goto
BAD
;
ret
=
PyDict_SetItemString
(((
PyTypeObject
*
)
type_obj
)
->
tp_dict
,
"__reduce__"
,
reduce_cython
);
if
(
ret
<
0
)
goto
BAD
;
ret
=
PyDict_DelItemString
(((
PyTypeObject
*
)
type_obj
)
->
tp_dict
,
"__reduce_cython__"
);
ret
=
PyDict_DelItemString
(((
PyTypeObject
*
)
type_obj
)
->
tp_dict
,
"__reduce_cython__"
);
PyType_Modified
((
PyTypeObject
*
)
type_obj
);
PyType_Modified
((
PyTypeObject
*
)
type_obj
);
...
@@ -100,8 +96,5 @@ GOOD:
...
@@ -100,8 +96,5 @@ GOOD:
Py_XDECREF
(
reduce
);
Py_XDECREF
(
reduce
);
Py_XDECREF
(
reduce_ex
);
Py_XDECREF
(
reduce_ex
);
Py_XDECREF
(
reduce_cython
);
Py_XDECREF
(
reduce_cython
);
Py_XDECREF
(
reduce_name
);
Py_XDECREF
(
reduce_cython_name
);
Py_XDECREF
(
same_name
);
return
ret
;
return
ret
;
}
}
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