Message258905
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. |
|
Date |
User |
Action |
Args |
2016-01-25 16:13:08 | hniksic | set | recipients:
+ hniksic, docs@python |
2016-01-25 16:13:08 | hniksic | set | messageid: <1453738388.34.0.790534194643.issue26198@psf.upfronthosting.co.za> |
2016-01-25 16:13:08 | hniksic | link | issue26198 messages |
2016-01-25 16:13:07 | hniksic | create | |
|