aboutsummaryrefslogtreecommitdiffstats
path: root/python/gevent/_util_py2.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-09-14 19:32:27 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-09-14 19:32:27 -0700
commit4212164e91ba2f49583cf44ad623a29b36db8f77 (patch)
tree47aefe3c0162f03e0c823b43873356f69c1cd636 /python/gevent/_util_py2.py
parent6ca20ff7010f2bafc7fefcb8cad982be27a8aeae (diff)
downloadyt-local-4212164e91ba2f49583cf44ad623a29b36db8f77.tar.lz
yt-local-4212164e91ba2f49583cf44ad623a29b36db8f77.tar.xz
yt-local-4212164e91ba2f49583cf44ad623a29b36db8f77.zip
Windows: Use 32-bit distribution of python
Diffstat (limited to 'python/gevent/_util_py2.py')
-rw-r--r--python/gevent/_util_py2.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/python/gevent/_util_py2.py b/python/gevent/_util_py2.py
index dc74eec..02332e3 100644
--- a/python/gevent/_util_py2.py
+++ b/python/gevent/_util_py2.py
@@ -1,7 +1,23 @@
-# this produces syntax error on Python3
+import sys
__all__ = ['reraise']
-def reraise(type, value, tb):
- raise type, value, tb
+def exec_(_code_, _globs_=None, _locs_=None):
+ """Execute code in a namespace."""
+ if _globs_ is None:
+ frame = sys._getframe(1)
+ _globs_ = frame.f_globals
+ if _locs_ is None:
+ _locs_ = frame.f_locals
+ del frame
+ elif _locs_ is None:
+ _locs_ = _globs_
+ exec("""exec _code_ in _globs_, _locs_""")
+
+exec_("""def reraise(tp, value, tb=None):
+ try:
+ raise tp, value, tb
+ finally:
+ tb = None
+""")