Skip to content

gh-129165: Clarify that signal.raise_signal() sends signal to calling thread #129167

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Emir2099
Copy link

@Emir2099 Emir2099 commented Jan 22, 2025

The documentation for signal.raise_signal(signum) previously stated that it
"sends a signal to the calling process," which is misleading. In reality,
the signal is sent to the calling thread, which may cause different behavior
in multi-threaded applications.

This PR updates the documentation to clarify that raise_signal() sends
the signal to the calling thread instead of the entire process.

Fixes gh-129165.


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

@@ -397,7 +397,7 @@ The :mod:`signal` module defines the following functions:

.. function:: raise_signal(signum)

Sends a signal to the calling process. Returns nothing.
Sends a signal to the calling thread, not the entire process. Returns nothing.
Copy link
Member

Choose a reason for hiding this comment

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

  • While we're here, it might be worth mentioning that on POSIX systems, this is equivalent to calling signal.pthread_kill(threading.get_ident(), signum). Or, we could just link to the manpages for raise.
  • This is the correct description for POSIX, but what about Windows?

@ZeroIntensity ZeroIntensity added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Jan 22, 2025
@hugovk hugovk removed the needs backport to 3.12 only security fixes label Apr 10, 2025
@python-cla-bot
Copy link

python-cla-bot bot commented Apr 18, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

raise_signal docs imply process receives signal not thread
3 participants