[Python-projects] regression(?) between 0.9.0 and 0.10.0 (false
positive)
Sylvain Thénault
sylvain.thenault at logilab.fr
Mon Jun 12 18:18:38 CEST 2006
On Saturday 03 June à 18:08, Tobias Klausmann wrote:
> Hi!
Hi,
> Consider the following program:
>
> import sys
>
> try:
> for line in sys.stdin:
> print "Got a line"
>
> print "The last line was:"
> print line # culprit
>
> except KeyboardInterrupt:
> sys.stderr.write("Interrupted. Probably your fault.\n")
> sys.exit(1
>
> PyLint rightly complains (in 0.10.0+) that line might be
> undefined where it's marked "culprit".
>
> However, if I add "line = None" before the try: or between try:
> and the head of the for-loop, thwarning does not go away, as it
> should. v0.9.0 does not complain at all (it doesn't check for
> this error, as it seems).
yep, 0.9 wasn't checking for this.
I'll try to catch this until the next release (but sadly I've no
time at all for pylint now...)
> PS: I'd also be happy about suggestions of fixing this in a
> different way that makes Pylint happy.
hum, there are probably some but nothing at the top of my head right
now...
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list