Commit 1f184095 authored by Kirill Smelkov's avatar Kirill Smelkov

gpython: CPython3.8 always imports time via zipimport hook

	kirr@deco:~$ python3.8 -v
	import _frozen_importlib # frozen
	import _imp # builtin
	import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
	import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
	import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
	import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>
	import '_io' # <class '_frozen_importlib.BuiltinImporter'>
	import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
	import 'posix' # <class '_frozen_importlib.BuiltinImporter'>
	import _thread # previously loaded ('_thread')
	import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
	import _weakref # previously loaded ('_weakref')
	import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
	# installing zipimport hook
	import 'time' # <class '_frozen_importlib.BuiltinImporter'>		<-- NOTE
	import 'zipimport' # <class '_frozen_importlib.FrozenImporter'>
	# installed zipimport hook

See https://github.com/python/cpython/commit/79d1c2e6c9d1 for details
(`import time` in zipimport.py)
parent 792cbd6c
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2018-2019 Nexedi SA and Contributors. # Copyright (C) 2018-2020 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -136,8 +136,10 @@ def main(): ...@@ -136,8 +136,10 @@ def main():
avoid = ['pkg_resources', 'golang', 'socket', 'select', 'threading', avoid = ['pkg_resources', 'golang', 'socket', 'select', 'threading',
'thread', 'ssl', 'subprocess'] 'thread', 'ssl', 'subprocess']
# pypy7 made time always pre-imported (https://bitbucket.org/pypy/pypy/commits/6759b768) # pypy7 made time always pre-imported (https://bitbucket.org/pypy/pypy/commits/6759b768)
# cpython3.8 made time always pre-imported via zipimport hook:
# https://github.com/python/cpython/commit/79d1c2e6c9d1 (`import time` in zipimport.py)
pypy = ('PyPy' in sys.version) pypy = ('PyPy' in sys.version)
if not pypy: if (not pypy) and (sys.version_info < (3, 8)):
avoid.append('time') avoid.append('time')
bad = [] bad = []
for mod in avoid: for mod in avoid:
......
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