Message232046
This also affects SEH-related exceptions raised by ctypes. For example, VC++ uses exception code 0xE06D7363 (i.e. b'\xe0msc'), so unhandled VC++ exceptions leak into Python like this:
>>> ctypes.windll.kernel32.RaiseException(0xe06d7363, 0, 0, None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [WinError -529697949] Windows Error 0x%X
The ctypes SEH handler defaults to calling PyErr_SetFromWindowsErr(code). Since this isn't actually a Windows error code, Win32 FormatMessageW fails. Then Python uses the following default: PyUnicode_FromFormat("Windows Error 0x%X", err).
Normally (i.e. not under Wine) the OP's error number formats correctly:
>>> ctypes.windll.kernel32.RaiseException(10054, 0, 0, None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
PyErr_SetExcFromWindowsErrWithFilenameObjects
https://hg.python.org/cpython/file/ab2c023a9432/Python/errors.c#l553
PyErr_SetFromErrnoWithFilenameObjects
https://hg.python.org/cpython/file/ab2c023a9432/Python/errors.c#l416 |
|
Date |
User |
Action |
Args |
2014-12-02 19:46:05 | eryksun | set | recipients:
+ eryksun, vstinner, tim.golden, martin.panter, zach.ware, steve.dower |
2014-12-02 19:46:05 | eryksun | set | messageid: <1417549565.47.0.339529281133.issue22977@psf.upfronthosting.co.za> |
2014-12-02 19:46:05 | eryksun | link | issue22977 messages |
2014-12-02 19:46:05 | eryksun | create | |
|