[pypy-commit] pypy py3.5: Get open() from builtin module _io, instead of stdlib io

rlamy pypy.commits at gmail.com
Sat Jan 26 17:23:28 EST 2019


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r95732:bb4e8dfe6ac8
Date: 2019-01-26 22:22 +0000
http://bitbucket.org/pypy/pypy/changeset/bb4e8dfe6ac8/

Log:	Get open() from builtin module _io, instead of stdlib io

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1049,6 +1049,8 @@
             w_locals = d.w_locals
         if w_locals is None:            # CPython does this
             w_locals = space.w_None
+        if not we_are_translated() and modulename == 'io':
+            import pdb; pdb.set_trace()
         w_modulename = space.newtext(modulename)
         w_globals = self.get_w_globals()
         if w_flag is None:
diff --git a/pypy/module/__builtin__/state.py b/pypy/module/__builtin__/state.py
--- a/pypy/module/__builtin__/state.py
+++ b/pypy/module/__builtin__/state.py
@@ -2,8 +2,8 @@
 class State:
     def __init__(self, space):
         self.w_open = space.appexec([], """():
-                import io
-                return io.open""")
-        
+                import _io
+                return _io.open""")
+
 def get(space):
     return space.fromcache(State)


More information about the pypy-commit mailing list