This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, martin.panter, steve.dower, tim.golden, vstinner, zach.ware
Date 2014-12-02.19:46:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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


Date User Action Args
2014-12-02 19:46:05eryksunsetrecipients: + eryksun, vstinner, tim.golden, martin.panter, zach.ware, steve.dower
2014-12-02 19:46:05eryksunsetmessageid: <>
2014-12-02 19:46:05eryksunlinkissue22977 messages
2014-12-02 19:46:05eryksuncreate