Passing the wrong number of args to string printf-style
formatting should be detected. e.g. this code should
be caught be pychecker:
"%d %d %d" % (1, 2)
This is a frustrating bug that's all too easy to do.
Logged In: YES
In what case doesn't pychecker warn? It's a bug if it
doesn't warn. This was an early check IIRC. When I use the
code above, I get:
tt.py:9: Format string argument count (3) doesn't match
Logged In: YES
Hmm! Here's what I get:
andrew@trogdor ~ $ cat /tmp/foo.py
andrew@trogdor ~ $ pychecker /tmp/foo.py
/tmp/foo.py:3: Statement appears to have no effect
andrew@trogdor ~ $ pychecker --version
(I have the pychecker packaged with Ubuntu 5.04 (Hoary
Hedgehog) installed, pychecker 0.8.14-4ubuntu1)
I wonder why I get a different result?
Ah, if I use variables rather than constants, I get a
warning. I guess that's a bug then, but not a very serious one.
(i.e. "%d %d %d" % (a, b) instead of "%d %d %d" % (1, 2))
Thanks for the great tool, btw!
I just tested your exact example above that line with Python
2.2.x and Python-CVS (2.5) with the current CVS of
pychecker. I get both warnings--the no effect one and the
format one. I'm assuming your problem was a bug that's been
fixed. If you can test with the current CVS version of
pychecker that would be great. I should have a release out
in a week or so.
Ah, I think I know what the problem is/was. Python 2.4
optimized constant tuples. That problem in pychecker was
Everything is working reasonably well right now (lots of
bugs were fixed). But I may want to try to sneak a few more
fixes in if I can resolve any.