Skip to content

bpo-39691: Clarify io.open_code behavior #19824

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

Merged
merged 2 commits into from
May 1, 2020
Merged

Conversation

hauntsaninja
Copy link
Contributor

@hauntsaninja hauntsaninja commented Apr 30, 2020

The previous statement wasn't true, for instance, for absolute paths or pathlib.Path instances.

https://bugs.python.org/issue39691

The previous statement wasn't true. This change uses the language
from PEP 578 to describe io.open_code's behavior.
@hauntsaninja
Copy link
Contributor Author

Oops, this kind of reads like the opposite of what it's meant to mean. Will fix.

@hauntsaninja hauntsaninja marked this pull request as draft April 30, 2020 23:40
@@ -136,8 +136,8 @@ High-level Module Interface

The behavior of this function may be overridden by an earlier call to the
:c:func:`PyFile_SetOpenCodeHook`, however, it should always be considered
interchangeable with ``open(path, 'rb')``. Overriding the behavior is
intended for additional validation or preprocessing of the file.
interchangeable with ``open(abspath(str(path), 'rb')``. Overriding the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also change "should always be considered interchangeable with" to "should always behave the same as". The simpler language will be easier for most people to follow (including me... I just spent way to long figuring out what I meant here)

@hauntsaninja hauntsaninja marked this pull request as ready for review April 30, 2020 23:50
@hauntsaninja hauntsaninja requested a review from zooba April 30, 2020 23:50
@zooba
Copy link
Member

zooba commented May 1, 2020

Looks great 👍

@zooba zooba merged commit 831d58d into python:master May 1, 2020
@miss-islington
Copy link
Contributor

Thanks @hauntsaninja for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @hauntsaninja and @zooba, I had trouble checking out the 3.8 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 831d58d7865cb98fa09227dc614f4f3ce6af968b 3.8

@miss-islington
Copy link
Contributor

Thanks @hauntsaninja for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 1, 2020
(cherry picked from commit 831d58d)

Co-authored-by: Shantanu <[email protected]>
@bedevere-bot
Copy link

GH-19840 is a backport of this pull request to the 3.8 branch.

@hauntsaninja hauntsaninja deleted the opencodedoc branch May 1, 2020 17:58
miss-islington added a commit that referenced this pull request May 1, 2020
(cherry picked from commit 831d58d)

Co-authored-by: Shantanu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants