Commit e847c550 authored by Kirill Smelkov's avatar Kirill Smelkov

gpython: Don't check for time not being pre-imported on PyPy

PyPy7 always pre-imports the time module. Without the change tests were
failing:

	Traceback (most recent call last):
	  File "/home/kirr/src/tools/go/pygolang/.tox/pypy3-gevent/bin/gpython", line 10, in <module>
	    sys.exit(main())
	  File "/home/kirr/src/tools/go/pygolang/.tox/pypy3-gevent/site-packages/gpython/__init__.py", line 145, in main
	    '\n\n\t%s\n\nsys.modules:\n\n\t%s' % (bad, sysmodv))
	RuntimeError: gpython: internal error: the following modules are pre-imported, but must be not:

	        ['time']

	sys.modules:

	        ['__future__', '__main__', '__pypy__', '__pypy__._pypydatetime', '__pypy__.builders', '__pypy__.intop', '__pypy__.os', '__pypy__.thread', '__pypy__.time', '_ast', '_bootlocale', '_codecs', '_collections', '_collections_abc', '_continuation', '_csv', '_frozen_importlib', '_frozen_importlib_external', '_imp', '_io', '_locale', '_multibytecodec', '_operator', '_rawffi', '_rawffi.alt', '_signal', '_sre', '_structseq', '_thread', '_warnings', '_weakref', '_weakrefset', 'abc', 'array', 'builtins', 'codecs', 'copyreg', 'encodings', 'encodings.aliases', 'encodings.ascii', 'encodings.latin_1', 'encodings.utf_8', 'errno', 'gc', 'genericpath', 'gpython', 'marshal', 'os', 'os.path', 'posix', 'posixpath', 'pwd', 're', 'site', 'sre_compile', 'sre_constants', 'sre_parse', 'stat', 'sys', 'time', 'unicodedata']
parent da68a8ae
...@@ -133,9 +133,13 @@ def main(): ...@@ -133,9 +133,13 @@ def main():
# #
# (os and signal are imported by python startup itself) # (os and signal are imported by python startup itself)
# (on py3 _thread is imported by the interpreter early to support fine-grained import lock) # (on py3 _thread is imported by the interpreter early to support fine-grained import lock)
avoid = ['pkg_resources', 'golang', 'socket', 'select', 'threading',
'thread', 'ssl', 'subprocess']
# pypy7 made time always pre-imported (https://bitbucket.org/pypy/pypy/commits/6759b768)
if 'PyPy' not in sys.version:
avoid.append('time')
bad = [] bad = []
for mod in ('pkg_resources', 'golang', 'socket', 'time', 'select', for mod in avoid:
'threading', 'thread', 'ssl', 'subprocess'):
if mod in sys.modules: if mod in sys.modules:
bad.append(mod) bad.append(mod)
if bad: if bad:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment