Eryk Sun <eryk...@gmail.com> added the comment:

> I suspect that we've not used the flags in those ones because we 
> think we *can* properly format the message, so fixing the use of 
> inserts is a better option than simply going back to the 
> unformatted message.

We're advised that it's "unsafe to take an arbitrary system error code returned 
from an API and use FORMAT_MESSAGE_FROM_SYSTEM without 
FORMAT_MESSAGE_IGNORE_INSERTS". We don't control the content of system error 
messages. If we get the number and type of arguments wrong for the message 
inserts, then FormatMessageW may fail with an invalid parameter error, as it 
does in the examples I showed, or return nonsense, or even crash the process 
due to an unhandled access violation. 

Also, nothing was implemented in _overlapped.FormatMessage or 
_ctypes.FormatError to special case an `Arguments` array for particular error 
codes, or even to expose this capability to Python code. I think omitting the 
flag was just a mistake.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue26493>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to