Skip to content

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

Open
Emir2099 wants to merge 3 commits intopython:mainfrom
Emir2099:fix-signal-docs
Open

gh-129165: Clarify that signal.raise_signal() sends signal to calling thread#129167
Emir2099 wants to merge 3 commits intopython:mainfrom
Emir2099:fix-signal-docs

Conversation

@Emir2099
Copy link
Copy Markdown

@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/

Comment thread Doc/library/signal.rst
.. 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
Copy Markdown
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
Copy Markdown

python-cla-bot Bot commented Apr 18, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@serhiy-storchaka serhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 8, 2025
@github-actions
Copy link
Copy Markdown

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 Apr 21, 2026
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 needs backport to 3.14 bugs and security fixes skip news stale Stale PR or inactive for long period of time.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

raise_signal docs imply process receives signal not thread

4 participants