[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

STINNER Victor report at bugs.python.org
Wed Jan 5 04:02:35 CET 2011


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

Guido created the "convenience function" PyErr_Format() 13 years ago (r7580) with a naive implementation using char buffer[500] and vsprintf(). He added a comment:

/* Caller is responsible for limiting the format */

Ok, that was true 13 years ago. But today Python uses dynamically allocated buffers, and so we can simply replace %.100s ("%\.[0-9]+s" regex) by %s.

Anyway, PyUnicode_FromFormatV() doesn't support precision for %s and %U formats :-)

----------
components: Interpreter Core
messages: 125399
nosy: amaury.forgeotdarc, haypo
priority: normal
severity: normal
status: open
title: Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10833>
_______________________________________


More information about the Python-bugs-list mailing list