Skip to content

gh-85864: Mark no keyword arg for seek() #91683

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
Apr 23, 2022
Merged

Conversation

slateny
Copy link
Contributor

@slateny slateny commented Apr 19, 2022

@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Apr 19, 2022
@JelleZijlstra JelleZijlstra self-assigned this Apr 19, 2022
@JelleZijlstra
Copy link
Member

Actually, while we're here, could you confirm whether any other methods mentioned here need the same change? I checked and at least readline and readlines also take only positional arguments. Haven't looked at the others.

@slateny
Copy link
Contributor Author

slateny commented Apr 21, 2022

@JelleZijlstra Hmm, where is the position-only function parameters specified for these functions? I've tried looking at _pyio.py's base class / text wrapper but there's no / there, and while _io/clinic/textio.c.h does have the /, this says that PyDoc_STRVAR is just for docstrings so it doesn't seem that it would have impact on the implementation

@JelleZijlstra
Copy link
Member

Here:

_io._IOBase.readline
. The Argument Clinic input blocks marks the parameter as pos-only, and this does affect the runtime. _pyio.py doesn't ever actually get used as far as I can tell.

@slateny
Copy link
Contributor Author

slateny commented Apr 22, 2022

It seems that IOBase doesn't have seek() defined, while the docs do have it. Then, BytesIO's seek states that it has position-only arguments, yet in the docs, BytesIO inherits BufferedIOBase which inherits IOBase, and only IOBase has seek() in the docs. In this case, should the position-only marker be put onto IOBase's seek, or should the subclasses have seek written in the doc?

@JelleZijlstra JelleZijlstra self-requested a review April 22, 2022 15:37
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thank you!

@JelleZijlstra JelleZijlstra merged commit a3f2cf3 into python:main Apr 23, 2022
@miss-islington
Copy link
Contributor

Thanks @slateny for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-91847 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Apr 23, 2022
@miss-islington
Copy link
Contributor

Sorry, @slateny and @JelleZijlstra, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker a3f2cf3ced378db2569df4e7389ec1f79c85d55c 3.9

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 23, 2022
JelleZijlstra pushed a commit to JelleZijlstra/cpython that referenced this pull request Apr 23, 2022
@bedevere-bot
Copy link

GH-91848 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Apr 23, 2022
miss-islington added a commit that referenced this pull request Apr 23, 2022
(cherry picked from commit a3f2cf3)

Co-authored-by: slateny <[email protected]>
@slateny
Copy link
Contributor Author

slateny commented Apr 23, 2022

@JelleZijlstra Thanks for the merge - could you take a look at the comment here? I've got most of them but there's still some ambiguous cases

JelleZijlstra added a commit that referenced this pull request Apr 23, 2022
@JelleZijlstra
Copy link
Member

Sorry for missing that! I think we should just mark it as positional-only in the IOBase docs.

hello-adam pushed a commit to hello-adam/cpython that referenced this pull request Jun 2, 2022
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