Commit 0924a16f authored by Jason Madden's avatar Jason Madden

Fix test under PyPy

parent 3841f613
...@@ -37,16 +37,23 @@ def __import__(*args, **kwargs): ...@@ -37,16 +37,23 @@ def __import__(*args, **kwargs):
# however, so this is necessary. # however, so this is necessary.
args = args[1:] args = args[1:]
imp.acquire_lock() imp.acquire_lock()
_g_import_lock.acquire()
try: try:
result = _import(*args, **kwargs) try:
_g_import_lock.acquire()
except RuntimeError:
# we've seen this under PyPy, a recursion error
# importing 'platform'
return _import(*args, **kwargs)
try:
result = _import(*args, **kwargs)
finally:
_g_import_lock.release()
finally: finally:
_g_import_lock.release()
imp.release_lock() imp.release_lock()
return result return result
if sys.version_info[:2] >= (3, 3):
if sys.version_info[:2] < (3, 3):
__implements__ = [] __implements__ = []
else: else:
__implements__ = ['__import__'] __implements__ = ['__import__']
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# See https://github.com/gevent/gevent/issues/108 # See https://github.com/gevent/gevent/issues/108
import gevent import gevent
from gevent import monkey from gevent import monkey
monkey.patch_all() monkey.patch_all()
import_errors = [] import_errors = []
...@@ -13,6 +14,7 @@ def some_func(): ...@@ -13,6 +14,7 @@ def some_func():
assert x == 'done' assert x == 'done'
except ImportError as e: except ImportError as e:
import_errors.append(e) import_errors.append(e)
raise
gs = [gevent.spawn(some_func) for i in range(2)] gs = [gevent.spawn(some_func) for i in range(2)]
gevent.joinall(gs) gevent.joinall(gs)
......
...@@ -59,13 +59,13 @@ if LEAKTEST: ...@@ -59,13 +59,13 @@ if LEAKTEST:
if PYPY: if PYPY:
FAILING_TESTS += [ FAILING_TESTS += [
# Different in PyPy: ## Different in PyPy:
# Not implemented: ## Not implemented:
# --- ## ---
# BUGS: ## BUGS:
] ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment