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 Raúl Núñez de Arenas, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2016-03-06.19:58:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1457294325.33.0.938747836746.issue26493@psf.upfronthosting.co.za>
In-reply-to
Content
When Python creates an exception generically from a Windows error code, it calls WinAPI FormatMessage with the flag FORMAT_MESSAGE_IGNORE_INSERTS. The reason for this is explained in a blog post written by Raymond Chen[1]: "when you are not in control of the message, you had better pass the FORMAT_MESSAGE_IGNORE_INSERTS flag."

[1]: https://blogs.msdn.microsoft.com/oldnewthing/20071128-00/?p=24353

Some extension modules in the code base get this wrong. For example, ctypes.FormatError() doesn't use FORMAT_MESSAGE_IGNORE_INSERTS, so it fails to get the system error message for ERROR_BAD_EXE_FORMAT (193) and just returns its default string "<no description>":

    >>> ctypes.FormatError(193)
    '<no description>'
History
Date User Action Args
2016-03-06 19:58:45eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, Raúl Núñez de Arenas
2016-03-06 19:58:45eryksunsetmessageid: <1457294325.33.0.938747836746.issue26493@psf.upfronthosting.co.za>
2016-03-06 19:58:45eryksunlinkissue26493 messages
2016-03-06 19:58:45eryksuncreate