Skip to content

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

Merged
JelleZijlstra merged 2 commits into
python:mainfrom
slateny:s/io
Apr 23, 2022
Merged

JelleZijlstra merged 2 commits into
python:mainfrom
slateny:s/io

Conversation

@slateny

@slateny slateny commented Apr 19, 2022

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
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

slateny commented Apr 21, 2022 •

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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

slateny commented Apr 22, 2022

Copy link
Copy Markdown
Contributor Author

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

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
(cherry picked from commit a3f2cf3)

Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
JelleZijlstra pushed a commit to JelleZijlstra/cpython that referenced this pull request Apr 23, 2022
…91683).

(cherry picked from commit a3f2cf3)

Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
@bedevere-bot

Copy link
Copy Markdown

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

miss-islington added a commit that referenced this pull request Apr 23, 2022
(cherry picked from commit a3f2cf3)

Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
@slateny

slateny commented Apr 23, 2022

Copy link
Copy Markdown
Contributor Author

@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
)

(cherry picked from commit a3f2cf3)

Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
@JelleZijlstra

Copy link
Copy Markdown
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
…91683). (python#91848)

(cherry picked from commit a3f2cf3)

Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
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