Issue 1539955: Insane format string should cause ValueError (original) (raw)

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 "", line 1, in TypeError: not enough arguments for format string

A format string that mixes named and unnamed conversion specifiers should trigger a ValueError.