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
Gwenaël Samain
cython
Commits
cd81f278
Commit
cd81f278
authored
Mar 03, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test case for ticket #228
parent
ff46f601
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
tests/bugs/funcexc_iter_T228.pyx
tests/bugs/funcexc_iter_T228.pyx
+55
-0
No files found.
tests/bugs/funcexc_iter_T228.pyx
0 → 100644
View file @
cd81f278
__doc__
=
u"""
>>> def py_iterator():
... if True: return
... yield None
>>> list(py_iterator())
[]
>>> list(cy_iterator())
[]
>>> try:
... raise ValueError
... except:
... print(sys.exc_info()[0] is ValueError or sys.exc_info()[0])
... a = list(py_iterator())
... print(sys.exc_info()[0] is ValueError or sys.exc_info()[0])
... a = list(cy_iterator())
... print(sys.exc_info()[0] is ValueError or sys.exc_info()[0])
True
True
True
>>> if IS_PY3: print(sys.exc_info()[0] is None or sys.exc_info()[0])
... else: print(sys.exc_info()[0] is ValueError or sys.exc_info()[0])
True
>>> double_raise(py_iterator)
True
True
True
>>> if IS_PY3: print(sys.exc_info()[0] is None or sys.exc_info()[0])
... else: print(sys.exc_info()[0] is ValueError or sys.exc_info()[0])
True
"""
import
sys
IS_PY3
=
sys
.
version_info
[
0
]
>=
3
cdef
class
cy_iterator
(
object
):
def
__iter__
(
self
):
return
self
def
__next__
(
self
):
raise
StopIteration
def
double_raise
(
py_iterator
):
try
:
raise
ValueError
except
:
print
(
sys
.
exc_info
()[
0
]
is
ValueError
or
sys
.
exc_info
()[
0
])
a
=
list
(
py_iterator
())
print
(
sys
.
exc_info
()[
0
]
is
ValueError
or
sys
.
exc_info
()[
0
])
a
=
list
(
cy_iterator
())
print
(
sys
.
exc_info
()[
0
]
is
ValueError
or
sys
.
exc_info
()[
0
])
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