New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
checked hash-based pyc files not working with imp module #78237
Comments
OS: Clear Linux build 23460 Description: Steps to reproduce:
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' |
Can you not use imp? It's been deprecated since 3.4 and gradually become more and more broken and useless as this and other import improvements (e.g., namespace packages) have happened. |
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. |
I see. Thanks for being an early adopter! We can probably hack something together for imp. I'll send a PR in a moment. Filing bugs about imp usage would be valuable, especially if it flushes out any cases where imp provides functionality that our newer APIs don't. We'd quite like to kill imp. |
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
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: