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
Xavier Thompson
cython
Commits
cd3ce37d
Commit
cd3ce37d
authored
4 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid using the "tp_iternext" slot when CYTHON_USE_TYPE_SLOTS is disabled.
parent
c8f537ff
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
15 deletions
+9
-15
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-2
Cython/Utility/Coroutine.c
Cython/Utility/Coroutine.c
+4
-12
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+2
-0
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+1
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
cd3ce37d
...
...
@@ -2808,7 +2808,7 @@ class IteratorNode(ExprNode):
# PyObject_GetIter() fails if "tp_iternext" is not set, but the check below
# makes it visible to the C compiler that the pointer really isn't NULL, so that
# it can distinguish between the special cases and the generic case
code
.
putln
(
"%s =
Py_TYPE(%s)->tp_iternext
; %s"
%
(
code
.
putln
(
"%s =
__Pyx_PyObject_GetIterNext(%s)
; %s"
%
(
self
.
iter_func_ptr
,
self
.
py_result
(),
code
.
error_goto_if_null
(
self
.
iter_func_ptr
,
self
.
pos
)))
if
self
.
may_be_a_sequence
:
...
...
@@ -7775,7 +7775,7 @@ class SequenceNode(ExprNode):
rhs
.
generate_disposal_code
(
code
)
iternext_func
=
code
.
funcstate
.
allocate_temp
(
self
.
_func_iternext_type
,
manage_ref
=
False
)
code
.
putln
(
"%s =
Py_TYPE(%s)->tp_iternext
;"
%
(
code
.
putln
(
"%s =
__Pyx_PyObject_GetIterNext(%s)
;"
%
(
iternext_func
,
iterator_temp
))
unpacking_error_label
=
code
.
new_label
(
'unpacking_failed'
)
...
...
This diff is collapsed.
Click to expand it.
Cython/Utility/Coroutine.c
View file @
cd3ce37d
...
...
@@ -44,11 +44,7 @@ static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject
return
NULL
;
}
// source_gen is now the iterator, make the first next() call
#if CYTHON_USE_TYPE_SLOTS
retval
=
Py_TYPE
(
source_gen
)
->
tp_iternext
(
source_gen
);
#else
retval
=
PyIter_Next
(
source_gen
);
#endif
retval
=
__Pyx_PyObject_GetIterNext
(
source_gen
)(
source_gen
);
}
if
(
likely
(
retval
))
{
gen
->
yieldfrom
=
source_gen
;
...
...
@@ -77,11 +73,7 @@ static PyObject* __Pyx__Coroutine_Yield_From_Generic(__pyx_CoroutineObject *gen,
if
(
__Pyx_Coroutine_Check
(
source_gen
))
{
retval
=
__Pyx_Generator_Next
(
source_gen
);
}
else
{
#if CYTHON_USE_TYPE_SLOTS
retval
=
Py_TYPE
(
source_gen
)
->
tp_iternext
(
source_gen
);
#else
retval
=
PyIter_Next
(
source_gen
);
#endif
retval
=
__Pyx_PyObject_GetIterNext
(
source_gen
)(
source_gen
);
}
if
(
retval
)
{
gen
->
yieldfrom
=
source_gen
;
...
...
@@ -857,7 +849,7 @@ static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
#endif
{
if
(
value
==
Py_None
)
ret
=
Py_TYPE
(
yf
)
->
tp_iternext
(
yf
);
ret
=
__Pyx_PyObject_GetIterNext
(
yf
)
(
yf
);
else
ret
=
__Pyx_PyObject_CallMethod1
(
yf
,
PYIDENT
(
"send"
),
value
);
}
...
...
@@ -955,7 +947,7 @@ static PyObject *__Pyx_Generator_Next(PyObject *self) {
ret
=
__Pyx_Coroutine_Send
(
yf
,
Py_None
);
}
else
#endif
ret
=
Py_TYPE
(
yf
)
->
tp_iternext
(
yf
);
ret
=
__Pyx_PyObject_GetIterNext
(
yf
)
(
yf
);
gen
->
is_running
=
0
;
//Py_DECREF(yf);
if
(
likely
(
ret
))
{
...
...
This diff is collapsed.
Click to expand it.
Cython/Utility/ModuleSetupCode.c
View file @
cd3ce37d
...
...
@@ -711,8 +711,10 @@ static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict,
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
#define __Pyx_PyObject_GetIterNext(obj) (Py_TYPE(obj)->tp_iternext)
#else
#define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
#define __Pyx_PyObject_GetIterNext(obj) PyIter_Next
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
...
...
This diff is collapsed.
Click to expand it.
Cython/Utility/ObjectHandling.c
View file @
cd3ce37d
...
...
@@ -133,7 +133,7 @@ static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyOb
if
(
unlikely
(
!
iter
))
goto
bad
;
if
(
decref_tuple
)
{
Py_DECREF
(
tuple
);
tuple
=
NULL
;
}
iternext
=
Py_TYPE
(
iter
)
->
tp_iternext
;
iternext
=
__Pyx_PyObject_GetIterNext
(
iter
)
;
value1
=
iternext
(
iter
);
if
(
unlikely
(
!
value1
))
{
index
=
0
;
goto
unpacking_failed
;
}
value2
=
iternext
(
iter
);
if
(
unlikely
(
!
value2
))
{
index
=
1
;
goto
unpacking_failed
;
}
if
(
!
has_known_size
&&
unlikely
(
__Pyx_IternextUnpackEndCheck
(
iternext
(
iter
),
2
)))
goto
bad
;
...
...
This diff is collapsed.
Click to expand it.
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