[pypy-commit] pypy release-2.3.x: Like CPython, the built-in module should be "_struct", imported

arigo noreply at buildbot.pypy.org
Fri May 9 19:50:11 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: release-2.3.x
Changeset: r71436:1c713161e6ab
Date: 2014-05-09 19:42 +0200
http://bitbucket.org/pypy/pypy/changeset/1c713161e6ab/

Log:	Like CPython, the built-in module should be "_struct", imported by
	the file "lib-python/2.7/struct.py". Fixes a very obscure
	ImportError by running "-m idlelib.idle".

diff --git a/pypy/module/struct/__init__.py b/pypy/module/struct/__init__.py
--- a/pypy/module/struct/__init__.py
+++ b/pypy/module/struct/__init__.py
@@ -45,6 +45,8 @@
 
 The variable struct.error is an exception raised on errors."""
 
+    applevel_name = "_struct"
+
     interpleveldefs = {
         'error': 'interp_struct.get_error(space)',
 
@@ -55,6 +57,7 @@
         'unpack_from': 'interp_struct.unpack_from',
 
         'Struct': 'interp_struct.W_Struct',
+        '_clearcache': 'interp_struct.clearcache',
     }
 
     appleveldefs = {
diff --git a/pypy/module/struct/interp_struct.py b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -138,3 +138,6 @@
     pack_into=interp2app(W_Struct.descr_pack_into),
     unpack_from=interp2app(W_Struct.descr_unpack_from),
 )
+
+def clearcache(space):
+    """No-op on PyPy"""


More information about the pypy-commit mailing list