You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee=Noneclosed_at=<Date2018-07-07.03:41:11.077>created_at=<Date2018-07-05.22:31:12.837>labels= ['interpreter-core', 'type-bug', '3.7']
title='checked hash-based pyc files not working with imp module'updated_at=<Date2018-07-07.04:00:48.180>user='https://github.com/phmccarty'
I am seeing an uncaught exception in Python 3.7.0 when using the "imp" module to import a module that has a checked hash-based pyc file. See the attached source files.
Steps to reproduce:
Copy attached source files to a directory
In that directory, run
$ python3.7 -m compileall --invalidation-mode checked-hash imp-test-mod.py
$ python3.7 imp-test.py
See the resulting output (omitting the imp deprecation notice):
Traceback (most recent call last):
File "imp-test.py", line 6, in <module>
mod = imp.load_module(modname, f, p, d)
File "/usr/lib/python3.7/imp.py", line 235, in load_modulereturn load_source(name, filename, file)
File "/usr/lib/python3.7/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 838, in get_codeTypeError: a bytes-like object is required, not 'str'
I would like to avoid using imp, but I work on a distro team that ships many packages that still use the module. We wanted to start using checked-hash invalidation right away after upgrading to 3.7.0, but some of our release tests failed due to this issue.
I am willing to file bugs against other projects still using imp to stop using it, if that is the recommended direction. Considering that imp still works with timestamp invalidation, and checked-hash invalidation being a brand new feature, I wanted to file a bug here first before reaching out to the other projects.