[issue12011] The signal module should raise OSError for OS-related exceptions, not RuntimeError

Antoine Pitrou report at bugs.python.org
Thu May 5 22:49:40 CEST 2011


New submission from Antoine Pitrou <pitrou at free.fr>:

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 "<stdin>", line 1, in <module>
RuntimeError: (22, 'Invalid argument')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
AttributeError: 'RuntimeError' object has no attribute 'errno'


Changing it breaks compatibility a bit but I think it's worth it.

----------
components: Library (Lib)
messages: 135243
nosy: haypo, ncoghlan, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: The signal module should raise OSError for OS-related exceptions, not RuntimeError
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12011>
_______________________________________


More information about the Python-bugs-list mailing list