[Python-Dev] possible string formatting bug

Eli Courtwright eli at courtwright.org
Mon Oct 8 17:07:56 CEST 2007


Greetings,

I've found what might be a bug in Python's % string formatting operator.
Consider the following code:

"%%(%s)=%%s" % "hello"

On "Python 2.5.1 (r251:54863, May 18 2007, 16:56:43) [GCC 3.4.4 (cygming
special, gdc 0.12, using dmd 0.125)] on cygwin" this produces the string
"%(hello)s=%s" which is what I'd expect.

On "Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32" this produces the following exception:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: not enough arguments for format string

Note that this is the exact same revision running on the same machine, but
it doesn't work for the win32 version and does work for the cygwin version.

I wish I had time to track down the source of the problem and submit a
patch.  But unfortunately I need to get back to work, and I won't even have
the free time after work to tackle this.  So I figured I'd kick it off to
the Python Dev list in case anyone deems this important enough to be worth
their time.

By the way, Python is my favorite language and I use it whenever possible
and have even gotten some co-workers to start using it.  Thanks for the
great language!

- Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20071008/25d30a8c/attachment.htm 


More information about the Python-Dev mailing list