Author: Ronan Lamy <[email protected]>
Branch: py3tests
Changeset: r94501:a79923d36cf1
Date: 2018-05-08 16:12 +0100
http://bitbucket.org/pypy/pypy/changeset/a79923d36cf1/
Log: Fix translation
diff --git a/pypy/goal/targetpypystandalone.py
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -341,10 +341,10 @@
translate.log_config(config.objspace, "PyPy config object")
# obscure hack to stuff the translation options into the translated
PyPy
- import pypy.module.sys
+ from pypy.module.sys.moduledef import Module as SysModule
options = make_dict(config)
- wrapstr = 'space.wrap(%r)' % (options) # import time
- pypy.module.sys.Module.interpleveldefs['pypy_translation_info'] =
wrapstr
+ wrapstr = 'space.wrap(%r)' % (options) # import time
+ SysModule.interpleveldefs['pypy_translation_info'] = wrapstr
if config.objspace.usemodules._cffi_backend:
self.hack_for_cffi_modules(driver)
diff --git a/pypy/interpreter/mixedmodule.py b/pypy/interpreter/mixedmodule.py
--- a/pypy/interpreter/mixedmodule.py
+++ b/pypy/interpreter/mixedmodule.py
@@ -189,7 +189,7 @@
def extra_interpdef(self, name, spec):
cls = self.__class__
- pkgroot = cls.__module__
+ pkgroot = cls.__module__.rsplit('.', 1)[0]
loader = getinterpevalloader(pkgroot, spec)
space = self.space
w_obj = loader(space)
diff --git a/pypy/module/_rawffi/alt/__init__.py
b/pypy/module/_rawffi/alt/__init__.py
--- a/pypy/module/_rawffi/alt/__init__.py
+++ b/pypy/module/_rawffi/alt/__init__.py
@@ -1,18 +0,0 @@
-from pypy.interpreter.mixedmodule import MixedModule
-import os
-
-class Module(MixedModule):
-
- interpleveldefs = {
- 'types': 'interp_ffitype.W_types',
- 'CDLL': 'interp_funcptr.W_CDLL',
- 'FuncPtr': 'interp_funcptr.W_FuncPtr',
- 'get_libc':'interp_funcptr.get_libc',
- '_StructDescr': 'interp_struct.W__StructDescr',
- 'Field': 'interp_struct.W_Field',
- }
- if os.name == 'nt':
- interpleveldefs['WinDLL'] = 'interp_funcptr.W_WinDLL'
- appleveldefs = {
- 'Structure': 'app_struct.Structure',
- }
diff --git a/pypy/module/_rawffi/alt/__init__.py
b/pypy/module/_rawffi/alt/moduledef.py
copy from pypy/module/_rawffi/alt/__init__.py
copy to pypy/module/_rawffi/alt/moduledef.py
diff --git a/pypy/module/_rawffi/moduledef.py b/pypy/module/_rawffi/moduledef.py
--- a/pypy/module/_rawffi/moduledef.py
+++ b/pypy/module/_rawffi/moduledef.py
@@ -2,7 +2,7 @@
"""
from pypy.interpreter.mixedmodule import MixedModule
-from pypy.module._rawffi import alt
+from pypy.module._rawffi.alt.moduledef import Module as AltModule
class Module(MixedModule):
interpleveldefs = {
@@ -36,7 +36,7 @@
}
submodules = {
- 'alt': alt.Module,
+ 'alt': AltModule,
}
def buildloaders(cls):
diff --git a/pypy/module/cpyext/pythonrun.py b/pypy/module/cpyext/pythonrun.py
--- a/pypy/module/cpyext/pythonrun.py
+++ b/pypy/module/cpyext/pythonrun.py
@@ -40,9 +40,9 @@
called at most once. Since Python's internal finalization will have
completed before the cleanup function, no Python APIs should be called by
func."""
- from pypy.module import cpyext
+ from pypy.module.cpyext.moduledef import Module
w_module = space.getbuiltinmodule('cpyext')
- module = space.interp_w(cpyext.Module, w_module)
+ module = space.interp_w(Module, w_module)
try:
module.register_atexit(func_ptr)
except ValueError:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit