bpo-39691: Clarify io.open_code behavior#19824
Conversation
The previous statement wasn't true. This change uses the language from PEP 578 to describe io.open_code's behavior.
|
Oops, this kind of reads like the opposite of what it's meant to mean. Will fix. |
Doc/library/io.rst
Outdated
| :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 |
There was a problem hiding this comment.
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)
|
Looks great 👍 |
|
Thanks @hauntsaninja for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8. |
|
Sorry @hauntsaninja and @zooba, I had trouble checking out the |
|
Thanks @hauntsaninja for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8. |
(cherry picked from commit 831d58d) Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
|
GH-19840 is a backport of this pull request to the 3.8 branch. |
The previous statement wasn't true, for instance, for absolute paths or pathlib.Path instances.
https://bugs.python.org/issue39691