Issue 12011: The signal module should raise OSError for OS-related exceptions, not RuntimeError (original) (raw)

Issue12011

Created on 2011-05-05 20:49 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
signal_oserror.patch vstinner,2011-05-08 23:09 review
Messages (5)
msg135243 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-05 20:49
Treating RuntimeError as if it could take an errno is no good: >>> try: signal.siginterrupt(32, 12345) ... except RuntimeError as e: print(e.errno) ... Traceback (most recent call last): File "", line 1, in RuntimeError: (22, 'Invalid argument') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 2, in AttributeError: 'RuntimeError' object has no attribute 'errno' Changing it breaks compatibility a bit but I think it's worth it.
msg135244 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-05-05 20:56
I asked if I should use RuntimeError or OSError for the new signal functions (#8407) on python-dev. Georg Brandl answered: "If it has an errno, it should be a subclass of EnvironmentError."
msg135550 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-05-08 23:09
Patch: signal.signal() and signal.siginterrupt() raise an OSError, instead of a RuntimeError: OSError has an errno attribute.
msg135706 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-10 14:19
> Patch: signal.signal() and signal.siginterrupt() raise an OSError, > instead of a RuntimeError: OSError has an errno attribute. > > ---------- > keywords: +patch > Added file: http://bugs.python.org/file21939/signal_oserror.patch Looks good to me.
msg135710 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-05-10 15:15
New changeset b86b39211ef1 by Victor Stinner in branch 'default': Issue #12011: signal.signal() and signal.siginterrupt() raise an OSError, http://hg.python.org/cpython/rev/b86b39211ef1
History
Date User Action Args
2022-04-11 14:57:16 admin set github: 56220
2011-05-10 15:24:25 vstinner set status: open -> closedresolution: fixed
2011-05-10 15:15:04 python-dev set nosy: + python-devmessages: +
2011-05-10 14:19:25 pitrou set messages: +
2011-05-08 23:09:43 vstinner set files: + signal_oserror.patchkeywords: + patchmessages: +
2011-05-05 20:56:33 vstinner set nosy: + georg.brandl
2011-05-05 20:56:05 vstinner set messages: +
2011-05-05 20:49:39 pitrou create