[pypy-svn] r74118 - in pypy/branch/cpython-extension/pypy/module/cpyext: . test

exarkun at codespeak.net exarkun at codespeak.net
Tue Apr 27 18:39:44 CEST 2010


Author: exarkun
Date: Tue Apr 27 18:39:42 2010
New Revision: 74118

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/api.py
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_cpyext.py
Log:
Consider only the module name when computing the extension module initializer name; also fix a bug in import_module introduced in the previous change to that method

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/api.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/api.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/api.py	Tue Apr 27 18:39:42 2010
@@ -738,7 +738,7 @@
             "unable to load extension module '%s': %s",
             path, e.msg)
     try:
-        initptr = libffi.dlsym(dll.lib, 'init%s' % (name,))
+        initptr = libffi.dlsym(dll.lib, 'init%s' % (name.split('.')[-1],))
     except KeyError:
         raise operationerrfmt(
             space.w_ImportError,

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_cpyext.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_cpyext.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_cpyext.py	Tue Apr 27 18:39:42 2010
@@ -153,10 +153,10 @@
             """ % dict(name=name, init=init, body=body)
             kwds = dict(separate_module_sources=[code])
         else:
-            if filename is not None:
-                name = filename
+            if filename is None:
+                filename = name
             filename = py.path.local(autopath.pypydir) / 'module' \
-                    / 'cpyext'/ 'test' / (name + ".c")
+                    / 'cpyext'/ 'test' / (filename + ".c")
             kwds = dict(separate_module_files=[filename])
 
         state = self.space.fromcache(State)
@@ -327,7 +327,6 @@
         the module name (the part after the last dot) is considered when
         computing the name of the module initializer function.
         """
-        skip("This is not supported at present.")
         expected_name = "pypy.module.cpyext.test.dotted"
         module = self.import_module(name=expected_name, filename="dotted")
         assert module.__name__ == expected_name



More information about the Pypy-commit mailing list