Author hniksic
Recipients docs@python, hniksic
Date 2016-01-25.16:13:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1453738388.34.0.790534194643.issue26198@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for the "es#" format (and the "et#" that derives from it) documents the possibility of providing an already allocated buffer. Buffer overflow is detected and handled as follows: "If the buffer is not large enough, a ValueError will be set."

However, the actual behavior is to raise a TypeError. Inspecting the code in getargs.c reveals that convertsimple() handles buffer overflow by returning a formatted message to its caller, convertitem(). Calls to convertitem() that return an error call seterror() to set the error, and seterror() unconditionally sets the PyExc_TypeError.

This is not a big issue in practice, and since the behavior is not new, it might be best to simply update the documentation to match the existing practice instead of changing the behavior and risking breaking working code.
History
Date User Action Args
2016-01-25 16:13:08hniksicsetrecipients: + hniksic, docs@python
2016-01-25 16:13:08hniksicsetmessageid: <1453738388.34.0.790534194643.issue26198@psf.upfronthosting.co.za>
2016-01-25 16:13:08hniksiclinkissue26198 messages
2016-01-25 16:13:07hniksiccreate