Message 321139 - Python tracker

Message321139

Author phmccarty
Recipients phmccarty
Date 2018-07-05.22:31:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530829872.86.0.56676864532.issue34056@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2018-07-05 22:31:12phmccartysetrecipients: + phmccarty
2018-07-05 22:31:12phmccartysetmessageid: <1530829872.86.0.56676864532.issue34056@psf.upfronthosting.co.za>
2018-07-05 22:31:12phmccartylinkissue34056 messages
2018-07-05 22:31:12phmccartycreate