Skip to content
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

[3.7] closes bpo-34056: Always return bytes from _HackedGetData.get_data(). (GH-8130) #8146

Merged
merged 1 commit into from
Jul 7, 2018

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