Message341170
>> A new issue should be raised to fix the FormatMessage calls in the
>> standard library that mistakenly leave out
>> FORMAT_MESSAGE_IGNORE_INSERTS.
>
> Do you suggest to modify OSError constructor to modify the call to
> FormatMessageW(): don't pass the FORMAT_MESSAGE_IGNORE_INSERTS flag?
> I prefer "%1 is not a valid Win32 application" message than
> "<no description>".
I suggested creating a new issue to fix the calls that omit this flag. I think it's just two modules: Modules/overlapped.c and Modules/_ctypes/callproc.c. If there are more inserts than arguments (i.e. any inserts in our case since we pass no arguments), then FormatMessageW fails and the above modules use a default message. For example:
>>> _overlapped.FormatMessage(193)
'unknown error code 193'
>>> _ctypes.FormatError(193)
'<no description>'
> There is no need to re-raise the exception: the "strerror" attribute
> contains the error message and it can be modified.
I meant that Popen._execute_child would handle the exception by modifying and reraising it. In general for OSError exceptions, we could set `filename` to either `executable`, if it's defined, or else parse it out of the commandline. For ERROR_BAD_EXE_FORMAT (193), we could also change `strerror` to something like "Invalid executable format" instead of "%1 is not a valid Win32 application". This is more consistent with how we append ": {filename}" to the message. |
|
Date |
User |
Action |
Args |
2019-05-01 00:12:53 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, berker.peksag, zach.ware, steve.dower, Raúl Núñez de Arenas |
2019-05-01 00:12:53 | eryksun | set | messageid: <1556669573.27.0.0349125222422.issue26493@roundup.psfhosted.org> |
2019-05-01 00:12:53 | eryksun | link | issue26493 messages |
2019-05-01 00:12:52 | eryksun | create | |
|