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
Signal module doesnt raises ValueError Exception #65581
Comments
signal.signal() built-in function doesnt throws a ValueError exception in Windows when is called with a different signal than SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, or SIGTERM, as it is written in the documentation. https://docs.python.org/2/library/signal.html#signal.signal It throws an AttributeError Exception >>> import signal
>>> import sys
>>> sys.platform
'win32'
>>> signal.signal(signal.SIGPIPE, lambda signum, frame: sys.exit(1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'SIGPIPE'
>>> Regards |
It's about documentation only. The sentence is not wrong, but it is slightly confusing, and there's no hint which signals are defined on Windows. "On Windows, signal() can only be called with SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, or SIGTERM. A ValueError will be raised in any other case." Reading only this documentation, if the developer doesn't have a test platform on Windows, he could blindly write: try: ... until a Windows user detects the issue (thank you rsevcan) Now I just found this page which is relevant here ... either we could link to the page in a "See also" section, or give an hint about which signals are defined or not. |
To be honest I can't get excited about this one. The only sensible change is to remove the rather specific comment about ValueError and just leave the fact that only certain signals are valid. Because the C code defines module-level constants on the basis of whether the platform C-lib defines them, different platforms will have different module attributes. It would be unusual for us to list all the combinations. Adding Brian Curtin as he made the original change. |
New changeset 1fcf68e6f4c7 by Berker Peksag in branch '3.5': New changeset 3e27b21e3a7d by Berker Peksag in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: