You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
464 B
30 lines
464 B
5 years ago
|
"""Testing that greenlet restores sys.exc_info.
|
||
|
|
||
|
Passes with CPython + greenlet 0.4.0
|
||
|
|
||
|
Fails with PyPy 2.2.1
|
||
|
"""
|
||
|
from __future__ import print_function
|
||
|
import sys
|
||
|
import greenlet
|
||
|
|
||
|
|
||
|
print('Your greenlet version: %s' % (getattr(greenlet, '__version__', None), ))
|
||
|
|
||
|
|
||
|
result = []
|
||
|
|
||
|
|
||
|
def func():
|
||
|
result.append(repr(sys.exc_info()))
|
||
|
|
||
|
|
||
|
g = greenlet.greenlet(func)
|
||
|
try:
|
||
|
1 / 0
|
||
|
except ZeroDivisionError:
|
||
|
g.switch()
|
||
|
|
||
|
|
||
|
assert result == ['(None, None, None)'], result
|