Skip to content

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/

.. 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

@serhiy-storchaka serhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 8, 2025
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

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

raise_signal docs imply process receives signal not thread

4 participants