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

gh-114570: Add PythonFinalizationError exception #115352

Merged
merged 2 commits into from
Feb 14, 2024

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Feb 12, 2024

Add PythonFinalizationError exception. This exception derived from RuntimeError is raised when an operation is blocked during the Python finalization.

The following functions now raise PythonFinalizationError, instead of RuntimeError:

  • _thread.start_new_thread()
  • subprocess.Popen
  • os.fork()
  • os.fork1()
  • os.forkpty()

Morever, _winapi.Overlapped finalizer now logs an unraisable PythonFinalizationError, instead of an unraisable RuntimeError.


📚 Documentation preview 📚: https://cpython-previews--115352.org.readthedocs.build/

@vstinner
Copy link
Member Author

Copy link
Member

@gpshead gpshead left a comment

Choose a reason for hiding this comment

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

thanks!

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM.

vstinner and others added 2 commits February 14, 2024 22:52
Add PythonFinalizationError exception. This exception derived from
RuntimeError is raised when an operation is blocked during the Python
finalization.

The following functions now raise PythonFinalizationError, instead of
RuntimeError:

* _thread.start_new_thread()
* subprocess.Popen
* os.fork()
* os.fork1()
* os.forkpty()

Morever, _winapi.Overlapped finalizer now logs an unraisable
PythonFinalizationError, instead of an unraisable RuntimeError.
@vstinner vstinner force-pushed the python_finalization_error2 branch from 6d096b9 to 30bd9c9 Compare February 14, 2024 21:54
@vstinner
Copy link
Member Author

PR rebased on main to attempt to fix the macos-13 CI issue.

@vstinner vstinner merged commit 3e7b7df into python:main Feb 14, 2024
35 checks passed
@vstinner vstinner deleted the python_finalization_error2 branch February 14, 2024 22:35
@vstinner
Copy link
Member Author

Merged. Thanks for the review @gpshead and @serhiy-storchaka.

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.

3 participants