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

bpo-31938: Fix default-value signatures of several functions in the select module #21066

Merged
merged 1 commit into from
Jun 23, 2020

Conversation

asottile
Copy link
Contributor

@asottile asottile commented Jun 23, 2020

this appears to have regressed in 6dc57e2

https://bugs.python.org/issue31938

@taleinat
Copy link
Contributor

taleinat commented Jun 23, 2020

If this is the proper way to do it, this PR should also fix the default values for poll.register and devpoll.register similarly.

@vstinner
Copy link
Member

Oops, I didn't notice that you proposed a PR and so I wrote PR #21067 which is the same fix :-) Copy of my comment there.

inspect.signature() doesn't see the event_mask. Is it a bug in signature which doesn't support a signature written on two lines?

cc @serhiy-storchaka @1st1 @ambv

11:47:01 vstinner@apu$ ./python 
Python 3.10.0a0 (heads/pydoc_select:486e11db95, Jun 23 2020, 11:45:39) 
>>> import select
>>> select.epoll.register.__text_signature__
'($self, /, fd,\n         eventmask=select.EPOLLIN | select.EPOLLPRI | select.EPOLLOUT)'

>>> import inspect
>>> inspect.signature(select.epoll.register)
<Signature (self, /, fd)>

So pydoc doesn't show the whole signature:

./python -m pydoc select
(...)
     |  register(self, /, fd)
     |      Registers a new fd or raises an OSError if the fd is already registered.
     |      
     |        fd
     |          the target file descriptor of the operation
     |        eventmask
     |          a bit set composed of the various EPOLL constants
     |      
     |      The epoll interface supports all file descriptors that support poll.

@vstinner
Copy link
Member

If this is the proper way to do it, this PR should also fix the default values for poll.register and devpoll.register similarly.

IMO the fix is correct, so I concur thta the two other functions signature should also be fixed.

By the way, I suggest to rephase the NEWS entry to explain that the change fix the "signature" rather than fixing "pydoc".

@vstinner vstinner added needs backport to 3.8 only security fixes needs backport to 3.9 only security fixes labels Jun 23, 2020
@asottile asottile changed the title bpo-31938: Fix pydoc of select module bpo-31938: Fix default-value signatures of several functions in the select module Jun 23, 2020
@asottile
Copy link
Contributor Author

I fixed a few others as well -- good catch

@vstinner vstinner merged commit d051801 into python:master Jun 23, 2020
@miss-islington
Copy link
Contributor

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

@miss-islington
Copy link
Contributor

Sorry, @asottile and @vstinner, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker d051801052211b533c46a593b1c1bccf649a171c 3.9

@miss-islington
Copy link
Contributor

Sorry @asottile and @vstinner, I had trouble checking out the 3.8 backport branch.
Please backport using cherry_picker on command line.
cherry_picker d051801052211b533c46a593b1c1bccf649a171c 3.8

@vstinner
Copy link
Member

@asottile: Automated backport failed. Can you try to backport it manually (use cherry_picker or git cherry-pick -x)?

@asottile asottile deleted the pydoc_select_31938 branch June 23, 2020 21:57
asottile added a commit to asottile/cpython that referenced this pull request Jun 23, 2020
@bedevere-bot
Copy link

GH-21097 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 Jun 23, 2020
@bedevere-bot
Copy link

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

@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Jun 23, 2020
asottile added a commit to asottile/cpython that referenced this pull request Jun 23, 2020
miss-islington pushed a commit that referenced this pull request Jun 23, 2020
… the select module (GH-21066) (GH-21098)

(cherry picked from commit d051801)

Automerge-Triggered-By: @vstinner
miss-islington pushed a commit that referenced this pull request Jun 23, 2020
… the select module (GH-21066) (GH-21097)

(cherry picked from commit d051801)

Automerge-Triggered-By: @vstinner
@vstinner
Copy link
Member

vstinner commented Jun 23, 2020

pydoc doesn't show the eventmask parameter whereas it is in select.epoll.register.text_signature. I created bpo-41095: "inspect.signature() doesn't parse text_signature containing a newline character".

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.

None yet

6 participants