Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r88904:92ee15da58e2
Date: 2016-12-06 15:37 +0100
http://bitbucket.org/pypy/pypy/changeset/92ee15da58e2/

Log:    Fix for a few tests in lib-python/3/test/test_coroutine

diff --git a/lib_pypy/_testcapi.py b/lib_pypy/_testcapi.py
--- a/lib_pypy/_testcapi.py
+++ b/lib_pypy/_testcapi.py
@@ -4,16 +4,24 @@
 try:
     import cpyext
 except ImportError:
-    raise ImportError("No module named '_testcapi'")
+    pass   # no 'cpyext', but we still have to define e.g. awaitType
+else:
+    import _pypy_testcapi
+    cfile = '_testcapimodule.c'
+    thisdir = os.path.dirname(__file__)
+    output_dir = _pypy_testcapi.get_hashed_dir(os.path.join(thisdir, cfile))
 
-import _pypy_testcapi
-cfile = '_testcapimodule.c'
-thisdir = os.path.dirname(__file__)
-output_dir = _pypy_testcapi.get_hashed_dir(os.path.join(thisdir, cfile))
+    try:
+        fp, filename, description = imp.find_module('_testcapi',
+                                                    path=[output_dir])
+        with fp:
+            imp.load_module('_testcapi', fp, filename, description)
+    except ImportError:
+        _pypy_testcapi.compile_shared(cfile, '_testcapi', output_dir)
 
-try:
-    fp, filename, description = imp.find_module('_testcapi', path=[output_dir])
-    with fp:
-        imp.load_module('_testcapi', fp, filename, description)
-except ImportError:
-    _pypy_testcapi.compile_shared(cfile, '_testcapi', output_dir)
+
+class awaitType:
+    def __init__(self, iterator):
+        self._iterator = iterator
+    def __await__(self):
+        return self._iterator
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to