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
f862ea6a
Commit
f862ea6a
authored
Jul 28, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
streamline FetchStopIterationValue()
parent
5773ba74
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
25 deletions
+23
-25
Cython/Utility/Coroutine.c
Cython/Utility/Coroutine.c
+23
-25
No files found.
Cython/Utility/Coroutine.c
View file @
f862ea6a
...
...
@@ -430,43 +430,41 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
// most common case: plain StopIteration without or with separate argument
if
(
likely
(
et
==
PyExc_StopIteration
))
{
if
(
!
ev
)
{
Py_INCREF
(
Py_None
);
value
=
Py_None
;
}
#if PY_VERSION_HEX >= 0x030300A0
if
(
ev
&&
Py_TYPE
(
ev
)
==
(
PyTypeObject
*
)
PyExc_StopIteration
)
{
else
if
(
Py_TYPE
(
ev
)
==
(
PyTypeObject
*
)
PyExc_StopIteration
)
{
value
=
((
PyStopIterationObject
*
)
ev
)
->
value
;
Py_INCREF
(
value
);
Py_DECREF
(
ev
);
Py_XDECREF
(
tb
);
Py_DECREF
(
et
);
*
pvalue
=
value
;
return
0
;
}
#endif
if
(
!
ev
||
!
PyObject_TypeCheck
(
ev
,
(
PyTypeObject
*
)
PyExc_StopIteration
))
{
// PyErr_SetObject() and friends put the value directly into ev
if
(
!
ev
)
{
Py_INCREF
(
Py_None
);
ev
=
Py_None
;
}
else
if
(
unlikely
(
PyTuple_Check
(
ev
)))
{
// however, if it's a tuple, it is interpreted as separate constructor arguments (surprise!)
if
(
PyTuple_GET_SIZE
(
ev
)
>=
1
)
{
PyObject
*
value
;
// PyErr_SetObject() and friends put the value directly into ev
else
if
(
unlikely
(
PyTuple_Check
(
ev
)))
{
// if it's a tuple, it is interpreted as separate constructor arguments (surprise!)
if
(
PyTuple_GET_SIZE
(
ev
)
>=
1
)
{
#if !CYTHON_COMPILING_IN_CPYTHON
value
=
PySequence_ITEM
(
ev
,
0
);
value
=
PySequence_ITEM
(
ev
,
0
);
#else
value
=
PyTuple_GET_ITEM
(
ev
,
0
);
Py_INCREF
(
value
);
value
=
PyTuple_GET_ITEM
(
ev
,
0
);
Py_INCREF
(
value
);
#endif
Py_DECREF
(
ev
);
ev
=
value
;
}
else
{
Py_INCREF
(
Py_None
);
Py_DECREF
(
ev
);
ev
=
Py_None
;
}
}
else
{
Py_INCREF
(
Py_None
);
value
=
Py_None
;
}
Py_DECREF
(
ev
);
}
else
if
(
!
PyObject_TypeCheck
(
ev
,
(
PyTypeObject
*
)
PyExc_StopIteration
))
{
// 'steal' reference to ev
value
=
ev
;
}
if
(
likely
(
value
))
{
Py_XDECREF
(
tb
);
Py_DECREF
(
et
);
*
pvalue
=
ev
;
*
pvalue
=
value
;
return
0
;
}
}
else
if
(
!
PyErr_GivenExceptionMatches
(
et
,
PyExc_StopIteration
))
{
...
...
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