[pypy-commit] pypy py3.5: Always initialise __main__.__loader__ and __main__.__builtins__ (CPython does, it, don't ask me why)

rlamy pypy.commits at gmail.com
Wed Nov 15 17:09:06 EST 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r93048:6fc0a7040472
Date: 2017-11-15 22:08 +0000
http://bitbucket.org/pypy/pypy/changeset/6fc0a7040472/

Log:	Always initialise __main__.__loader__ and __main__.__builtins__
	(CPython does, it, don't ask me why)

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -579,6 +579,8 @@
         __pypy__.save_module_content_for_future_reload(sys)
 
     mainmodule = type(sys)('__main__')
+    mainmodule.__loader__ = sys.__loader__
+    mainmodule.__builtins__ = os.__builtins__
     sys.modules['__main__'] = mainmodule
 
     if not no_site:


More information about the pypy-commit mailing list