Skip to content

Conversation

@pklanke
Copy link

@pklanke pklanke commented Jul 4, 2017

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@pklanke pklanke closed this Jul 4, 2017
@pklanke pklanke reopened this Jul 4, 2017
@pklanke pklanke changed the title Fix issue 30844 bpo-30844: Fix issue 30844 Jul 4, 2017
@pklanke pklanke closed this Jul 4, 2017
@pklanke pklanke reopened this Jul 4, 2017
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

Wow, nice patch! Todo:

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

I would prefer to first focus on the selectors module to have a shorter PR, easier to review. And later extend asyncio.

I mean, keep your asyncio changes somewhere, and revert all asyncio changes here.

@vstinner vstinner changed the title bpo-30844: Fix issue 30844 bpo-30844: selectors and asyncio: add_excepter(), 3rd argument of select.select() Jul 4, 2017
@pklanke
Copy link
Author

pklanke commented Jul 4, 2017

If I understand correctly, you want me to:

  1. remove all references to asyncio from the original issue (bpo-30844) and remove the changes to asyncio/selector_events.py and related tests from this patch
  2. create a second issue regarding asyncio missing the same feature
  3. create a second patch solving the second issue

Step 2 and 3 can not exist without this patch. Chapter 11 of the Python Developers Guide, Triaging an issue states under 11.1.10. Dependencies, that dependencies can be listed to be resolved first, before an issue can move forward. Since their is no field marked "dependencies" when creating a new issue, do I just list them in the comment?

@vstinner
Copy link
Member

vstinner commented Jul 4, 2017

"create a second patch solving the second issue"

This can wait until this PR is merged ;-)

@pklanke pklanke force-pushed the fix-issue-30844 branch from 107695b to 5178574 Compare July 4, 2017 12:28
@pklanke pklanke changed the title bpo-30844: selectors and asyncio: add_excepter(), 3rd argument of select.select() bpo-30844: selectors: add_excepter(), 3rd argument of select.select() Jul 4, 2017
@pklanke
Copy link
Author

pklanke commented Jul 4, 2017

I am sorry, I see now that I have committed a foul (no pun intended). I removed the commit regarding asyncio from my branch and executed a force push to GitHub, something that is clearly listed as not allowed (sorry, newby). Do I need to fix this by reverting the change in the title, adding the commit again and then remove it explicitly and then again change the title, or should I just leave it for now

@vstinner
Copy link
Member

vstinner commented Jul 4, 2017

You can use git push --force on your branch, pklanke:fix-issue-30844.

I'm doing that multiple times per day :-) When I'm in my local branch (ex: "fix-issue-30844" in your case), I use "git push haypo HEAD -f", where "haypo" is my Git remote repostory (see "git remote -v").

@pklanke pklanke changed the title bpo-30844: selectors: add_excepter(), 3rd argument of select.select() bpo-30844: selectors: add exceptional urgent data event Jul 4, 2017
@pitrou
Copy link
Member

pitrou commented Jul 4, 2017

As a side note, kqueue does not seem to have support for urgent data. Asking for urgent data with kqueue should probably fail with a well-defined error (NotImplementedError?).

@vstinner
Copy link
Member

vstinner commented Jul 4, 2017

"As a side note, kqueue does not seem to have support for urgent data. Asking for urgent data with kqueue should probably fail with a well-defined error (NotImplementedError?)."

Oh. Maybe we should not add add_excepter() on KqueueSelector?

@pklanke
Copy link
Author

pklanke commented Jul 4, 2017

"Oh. Maybe we should not add add_excepter() on KqueueSelector?"

You're confusing me; You asked me to remove the asyncio related part from this patch and solely focus on the selectors patch first. add_excepter() is part of the asyncio patch and no longer a part of this patch. On top of that, add_excepter is, was, and will not be added to KqueueSelector.

@vstinner
Copy link
Member

vstinner commented Jul 4, 2017

"You're confusing me; You asked me to remove the asyncio related part from this patch and solely focus on the selectors patch first. add_excepter() is part of the asyncio patch and no longer a part of this patch."

Sorry, I didn't read carefully your PR. You're right, I'm wrong :-) Ignore my previous comment. Sadly, it seems like NotImplementedError is the only option for KqueueSelector. It should be carefully documented.

@pklanke pklanke changed the title bpo-30844: selectors: add exceptional urgent data event bpo-30844: selectors: add exceptional conditions event Jul 4, 2017
@pklanke
Copy link
Author

pklanke commented Jul 4, 2017

The kernel documentations for sysfs states the following:

If the pin can be configured as interrupt-generating interrupt and if it has been configured to generate interrupts (see the description of "edge"), you can poll(2) on that file and poll(2) will return whenever the interrupt was triggered. If you use poll(2), set the events POLLPRI and POLLERR. If you use select(2), set the file descriptor in exceptfds. After poll(2) returns, either lseek(2) to the beginning of the sysfs file and read the new value or close the file and re-open it to read the value.

In my opinion, sysfs kind of misuses available events to be able to support edge triggered io events, since the read event can not be used (sysfs GPIO fd's are always available for read). However, the patch has no relation to sysfs or TCP, sysfs is only mentioned as a use case for the exceptional conditions event.

Naming the event is not based on what it is used for, but on what lies beneath: man select(2), select_tot(2), poll(2) and epoll(7). IMO 'exceptional conditions event' is the best choice here, since this is the common denominator used by select (which was what we used before the selectors module was added in python 3.4). The term 'urgent data' originates from (e)poll, which some might say could also be used, but this would result in adding add_urgenter() to asyncio's selector_events module (again, not part of this patch anymore)

I really regret using the term 'urgent data' in the documentation and the title now ;-). Can we agree on calling it 'exceptional condition'?

@vstinner
Copy link
Member

vstinner commented Jul 4, 2017 via email

@pklanke pklanke changed the title bpo-30844: selectors: add exceptional conditions event bpo-30844: selectors: add urgent data to read event Jul 5, 2017
@pklanke pklanke force-pushed the fix-issue-30844 branch 3 times, most recently from d0415dd to 441380f Compare July 5, 2017 12:26
@pklanke pklanke force-pushed the fix-issue-30844 branch 2 times, most recently from b2a369d to 8f31d90 Compare September 27, 2017 09:48
Lib/selectors.py Outdated
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to add a comment explaining the w|x thing as well as the _w+_x below.

@1st1 1st1 requested review from 1st1 and removed request for 1st1 September 27, 2017 21:14
@pklanke
Copy link
Author

pklanke commented Nov 1, 2017

All checks have passed and no conflicts exist with the base branch. Is there anything more I can or need to to do to get this merged into the master branch?

Signed-off-by: Pim Klanke <pim@protonic.nl>
Signed-off-by: Pim Klanke <pim@protonic.nl>
This fixes an inconsistency between base class' select method, which
uses predefined class members _EVENT_READ and _EVENT_WRITE, and
EpollSelector.select, which uses select.EPOLL* events directly.

Signed-off-by: Pim Klanke <pim@protonic.nl>
Signed-off-by: Pim Klanke <pim@protonic.nl>
Naming the event for the exceptional conditions event was mainly based on
exceptfds, the 3rd argument of select(). Since except already has a very
distinctive meaning in the world of Python, it is better to replace it by
one of the already accepted synonyms, in this case "urgent data to read"
(used by poll()).

Signed-off-by: Pim Klanke <pim@protonic.nl>
Signed-off-by: Pim Klanke <pim@protonic.nl>
Signed-off-by: Pim Klanke <pim@protonic.nl>
precomputing the masks moves unnecessary computation out of the loop.

Signed-off-by: Pim Klanke <pim@protonic.nl>
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Feb 20, 2022
Copy link
Contributor

@MaxwellDupre MaxwellDupre left a comment

Choose a reason for hiding this comment

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

Got an error when running specific test:
./python -m unittest -v test.test_selectors.test_main

Ran 114 tests in 18.104s

OK (skipped=40)
Traceback (most recent call last):
File "/home/me/Documents/cpython/Lib/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/me/Documents/cpython/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/me/Documents/cpython/Lib/unittest/main.py", line 18, in
main(module=None)
File "/home/me/Documents/cpython/Lib/unittest/main.py", line 94, in init
self.parseArgs(argv)
File "/home/me/Documents/cpython/Lib/unittest/main.py", line 141, in parseArgs
self.createTests()
File "/home/me/Documents/cpython/Lib/unittest/main.py", line 148, in createTests
self.module)
File "/home/me/Documents/cpython/Lib/unittest/loader.py", line 219, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/home/me/Documents/cpython/Lib/unittest/loader.py", line 219, in
suites = [self.loadTestsFromName(name, module) for name in names]
File "/home/me/Documents/cpython/Lib/unittest/loader.py", line 211, in loadTestsFromName
(obj, test))
TypeError: calling <function test_main at 0x7ff7a4200338> returned None, not a test

cpython on  fix-issue-30844 [$?] via 🐍 v3.11.0a3+ took 18s

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Jul 28, 2022
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Aug 29, 2022
@arhadthedev arhadthedev added the 3.13 bugs and security fixes label Apr 21, 2023
@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Apr 22, 2023
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.13 bugs and security fixes awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.