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.

classification
Title: Insane format string should cause ValueError
Type: Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, ncoghlan
Priority: normal Keywords:

Created on 2006-08-14 12:14 by ncoghlan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg29518 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-08-14 12:14
The documentation explicitly disallows mixing
positional string interpolation and named string
interpolation, but the following fails to raise an error:

>>> "%s%(red)s" % dict(red=1, blue=2)
"{'blue': 2, 'red': 1}1"

Turning it around results in the wrong *kind* of error:

>>> "%(red)s%s" % dict(red=1, blue=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: not enough arguments for format string

A format string that mixes named and unnamed conversion
specifiers should trigger a ValueError.
msg29519 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-08-14 12:19
Logged In: YES 
user_id=849994

This is the same issue as #1467929.
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43818
2006-08-14 12:14:35ncoghlancreate