[issue34056] checked hash-based pyc files not working with imp module

2018-07-05 Thread Patrick McCarty


Patrick McCarty  added the comment:

Thanks for the response.

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.

--

___
Python tracker 
<https://bugs.python.org/issue34056>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34056] checked hash-based pyc files not working with imp module

2018-07-05 Thread Patrick McCarty


Change by Patrick McCarty :


Added file: https://bugs.python.org/file47672/imp-test-mod.py

___
Python tracker 
<https://bugs.python.org/issue34056>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34056] checked hash-based pyc files not working with imp module

2018-07-05 Thread Patrick McCarty


New submission from Patrick McCarty :

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 
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 "", line 696, in _load
  File "", line 677, in _load_unlocked
  File "", line 724, in exec_module
  File "", line 838, in get_code
TypeError: a bytes-like object is required, not 'str'

--
components: Interpreter Core
files: imp-test.py
messages: 321139
nosy: phmccarty
priority: normal
severity: normal
status: open
title: checked hash-based pyc files not working with imp module
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file47671/imp-test.py

___
Python tracker 
<https://bugs.python.org/issue34056>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com