[pypy-commit] pypy py3.5: Get the expected error when passing a bogus spec to _imp.create_dynamic()

rlamy pypy.commits at gmail.com
Thu Dec 7 13:03:46 EST 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r93301:e30b20325b57
Date: 2017-12-07 05:40 +0000
http://bitbucket.org/pypy/pypy/changeset/e30b20325b57/

Log:	Get the expected error when passing a bogus spec to
	_imp.create_dynamic()

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -1562,6 +1562,7 @@
     from rpython.rlib import rdynload
 
     w_name = space.getattr(w_spec, space.newtext("name"))
+    name = space.text_w(w_name)
     path = space.text_w(space.getattr(w_spec, space.newtext("origin")))
 
     if os.sep not in path:
@@ -1577,7 +1578,6 @@
         raise raise_import_error(space,
             space.newfilename(e.msg), w_name, w_path)
     look_for = None
-    name = space.text_w(w_name)
     #
     if space.config.objspace.usemodules._cffi_backend:
         basename = name.split('.')[-1]


More information about the pypy-commit mailing list