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 larry
Recipients larry
Date 2015-04-13.02:44:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
tl;dr: skipitem() in Python/getsargs.c doesn't know about the 'w*' format unit, which could lead to a crash.  It should know about it.


* you have an extension that parses its arguments with
  PyArg_ParseTupleAndKeywords (or its cousins),
* you have optional positional parameters, and
* you run out of positional arguments

CPython will call skipitem() to skip over the remaining positional parameters so it can process keyword arguments.  It does this by knowing all the format units, and iterating over them and throwing away the various varargs pointers until it hits the keyword arguments part of the format string.

Since nobody ever explained about the "w*" format unit to it, that means when it sees 'w*' it will misinterpret it.

In both 2.7 and 3.x, it'll interpret it as 'w', throw away one "char *" item from varargs, then the next thing that tries to parse a format unit (skipitem or convertsimple) will see the '*' and throw an 'impossible<bad format char>' exception.

(It's another bug that skipitem() supports 'w' and 'w#' in Python 3, but I filed that separately as #23926 .)
Date User Action Args
2015-04-13 02:44:28larrysetrecipients: + larry
2015-04-13 02:44:28larrysetmessageid: <>
2015-04-13 02:44:28larrylinkissue23927 messages
2015-04-13 02:44:27larrycreate