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

♲ Stop handling EINTR around time.sleep() #652

Merged
1 commit merged into from
Mar 23, 2024

Conversation

webknjaz
Copy link
Member

@webknjaz webknjaz commented Mar 22, 2024

IOError is an alias of OSError since Python 3.3. Python 3 also indroduced a new exception InterruptedError which represents EINTR. The time.sleep() call could raise

IOError: [Errno 4] Interrupted function call

on KBInt under Python 2, which would be InterruptedError under Python 3 but it's not raised anymore post PEP 475 that was implemented in Python 3.5. So it does not actually need to be handled in modern runtimes.

Refs:


This change is Reviewable

@webknjaz webknjaz added the enhancement Improvement label Mar 22, 2024
@webknjaz webknjaz self-assigned this Mar 22, 2024
Copy link

codecov bot commented Mar 22, 2024

Codecov Report

Merging #652 (f822e33) into main (e8471f4) will not change coverage.
The diff coverage is 0.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #652   +/-   ##
=======================================
  Coverage   82.61%   82.61%           
=======================================
  Files          28       28           
  Lines        4062     4062           
=======================================
  Hits         3356     3356           
  Misses        706      706           

`IOError` is an alias of `OSError` since Python 3.3. Python 3 also
indroduced a new exception `InterruptedError` which represents
`EINTR`. The `time.sleep()` call could raise

    IOError: [Errno 4] Interrupted function call

on KBInt under Python 2, which would be `InterruptedError` under
Python 3 but it's not raised anymore post PEP 475 that was implemented
in Python 3.5. So it does not actually need to be handled in modern
runtimes.

Refs:
* https://stackoverflow.com/a/52613818/595220
* https://peps.python.org/pep-0475/
* python/cpython#56671
* https://stackoverflow.com/a/38258781/595220
* https://docs.python.org/3/library/exceptions.html#InterruptedError
* python/cpython#36893
@webknjaz webknjaz closed this pull request by merging all changes into cherrypy:main in 8003361 Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant