Skip to content

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 7, 2018

Ensure the imp.load_source shim always returns bytes by reopening the file in
binary mode if needed. Hash-based pycs have to receive the source code in bytes.

It's tempting to change imp.get_suffixes() to always return 'rb' as a mode, but
that breaks some stdlib tests and likely 3rdparty code, too.
(cherry picked from commit b0274f2)

Co-authored-by: Benjamin Peterson benjamin@python.org

https://bugs.python.org/issue34056

…pythonGH-8130)

* Always return bytes from _HackedGetData.get_data().

Ensure the imp.load_source shim always returns bytes by reopening the file in
binary mode if needed. Hash-based pycs have to receive the source code in bytes.

It's tempting to change imp.get_suffixes() to always return 'rb' as a mode, but
that breaks some stdlib tests and likely 3rdparty code, too.
(cherry picked from commit b0274f2)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
@miss-islington
Copy link
Contributor Author

@benjaminp: Backport status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 7bd6f0e into python:3.7 Jul 7, 2018
@miss-islington miss-islington deleted the backport-b0274f2-3.7 branch July 7, 2018 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants