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
Boxiang Sun
cython
Commits
a47d63eb
Commit
a47d63eb
authored
Sep 15, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to fix test compilation problem with MSVC, where 1/0 is a compile time error.
parent
f7bcf72f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
tests/run/test_exceptions.pyx
tests/run/test_exceptions.pyx
+11
-6
No files found.
tests/run/test_exceptions.pyx
View file @
a47d63eb
...
...
@@ -127,12 +127,13 @@ class ExceptionTests(unittest.TestCase):
self
.
raise_catch
(
ValueError
,
"ValueError"
)
self
.
assertRaises
(
ValueError
,
chr
,
17
<<
16
)
ZERO
=
0
self
.
raise_catch
(
ZeroDivisionError
,
"ZeroDivisionError"
)
try
:
x
=
1
/
0
try
:
x
=
1
/
ZERO
except
ZeroDivisionError
:
pass
self
.
raise_catch
(
Exception
,
"Exception"
)
try
:
x
=
1
/
0
try
:
x
=
1
/
ZERO
except
Exception
as
e
:
pass
self
.
raise_catch
(
StopAsyncIteration
,
"StopAsyncIteration"
)
...
...
@@ -668,8 +669,9 @@ class ExceptionTests(unittest.TestCase):
# "can not delete variable 'e' referenced in nested scope"
def print_error():
e
ZERO = 0
try:
1/
0
1/
ZERO
except Exception as e:
print_error()
# implicit "del e" here
...
...
@@ -730,8 +732,9 @@ class ExceptionTests(unittest.TestCase):
yield
sys
.
exc_info
()[
1
]
it
=
g
()
next
(
it
)
ZERO
=
0
try
:
1
/
0
1
/
ZERO
except
ZeroDivisionError
as
e
:
self
.
assertIs
(
sys
.
exc_info
()[
1
],
e
)
gen_exc
=
it
.
throw
(
e
)
...
...
@@ -743,8 +746,9 @@ class ExceptionTests(unittest.TestCase):
# See issue #23353. When an exception is raised by a generator,
# the caller's exception state should still be restored.
def
g
():
ZERO
=
0
try
:
1
/
0
1
/
ZERO
except
ZeroDivisionError
:
yield
sys
.
exc_info
()[
0
]
raise
...
...
@@ -1275,8 +1279,9 @@ class ExceptionTests(unittest.TestCase):
with
self
.
assertRaises
(
ZeroDivisionError
):
i
=
g
()
ZERO
=
0
try
:
1
/
0
1
/
ZERO
except
:
next
(
i
)
next
(
i
)
...
...
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