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:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1428893040.89.0.319300847517.issue23926@psf.upfronthosting.co.za>
In-reply-to
Content
tl;dr: skipitem() in Python 3 still supports "w" and "w#", which were abandoned.  They should be removed.

--

If: 
* 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.

PyArg_ParseTuple() etc. in Python 2 supported "w" and "w#" for parsing "objects with the read-write buffer interface".  These were removed in Python 3.

skipitem() in Python 3 still supports both skipping "w" and "w#".  But in fact the only legal format unit starting with a 'w' in Python 3 is 'w*'.  So a function with a 'w*' as an optional parameter that got skipped would be misinterpreted; skipitem would see the 'w', not recognize the following '*' and leave it there, then the next function that read a character from the format string (either skipitem() or convertsimple()) would see the '*' and throw an "impossible <bad format char>" exception.
History
Date User Action Args
2015-04-13 02:44:00larrysetrecipients: + larry
2015-04-13 02:44:00larrysetmessageid: <1428893040.89.0.319300847517.issue23926@psf.upfronthosting.co.za>
2015-04-13 02:44:00larrylinkissue23926 messages
2015-04-13 02:44:00larrycreate