[New-bugs-announce] [issue19253] PyArg_ParseTuple: wrong use of seterror() clips helpful type error annotation

Georg Brandl report at bugs.python.org
Sun Oct 13 23:08:13 CEST 2013


New submission from Georg Brandl:

Follow-up to #6624. This issue changed a call to seterror() whose last argument is supposed to be NULL or a "custom error message" given by the ";message" format character.  This had two effects:

* the custom message (if present) is never printed
* the helpful "function() argument X " is omitted and only "must be str, not int" remains

>>> format(None, 1)     # current behavior
TypeError: must be str, not int
>>> format(None, 1)     # with #6624 reverted (= patch to this issue applied)
TypeError: format() argument 2 must be str, not int



Almost all uses of the ";" format code are currently broken: the strings must give a complete message, but only give a description of the expected arguments.  Most of them should probably just be removed.

----------
components: Interpreter Core
files: seterror_fix.patch
keywords: patch
messages: 199804
nosy: benjamin.peterson, georg.brandl, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: PyArg_ParseTuple: wrong use of seterror() clips helpful type error annotation
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file32100/seterror_fix.patch

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


More information about the New-bugs-announce mailing list