OS: Clear Linux build 23460
Python version: 3.7.0
Description:
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:
1) Copy attached source files to a directory
2) In that directory, run
$ python3.7 -m compileall --invalidation-mode checked-hash imp-test-mod.py
$ python3.7 imp-test.py
3) 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_module
return 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_code
TypeError: a bytes-like object is required, not 'str' |