[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#467135: pyflakes: Duplicated output



Package: pyflakes
Version: 0.2.1+svn14502-1
Severity: important

PyFlakes prints warnings twice as illustrated by this simple test case:

  % echo 'print not_defiled' | pyflakes
  <stdin>:1: undefined name 'not_defiled'
  <stdin>:1: undefined name 'not_defiled'

I looked at the source package and found that some of the patches
applied are wrong. The set_exit_status.diff patch is the worst since it
prints the warnings twice using this code:

           w = checker.Checker(tree, filename)
           w.messages.sort(lambda a, b: cmp(a.lineno, b.lineno))
           for warning in w.messages:
               print warning
  +            if status == 0:
  +                status = 1
  +            for warning in w.messages:
  +                print warning
           return len(w.messages)

The nested for-loop is the problem. It would be clearer if the status
variable was simply set like this:

           w = checker.Checker(tree, filename)
           w.messages.sort(lambda a, b: cmp(a.lineno, b.lineno))
           for warning in w.messages:
               print warning
  +        if status == 0 and len(w.messages) > 0:
  +            status = 1
           return len(w.messages)

The patch pyflakes_unicode.diff is wrong and does almost the same as
check_encoding_errors.diff. I think pyflakes_unicode.diff should simply
be dropped.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (900, 'testing'), (800, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-k7 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages pyflakes depends on:
ii  python                        2.4.4-6    An interactive high-level object-o
ii  python-central                0.5.15-0.1 register and build utility for Pyt

pyflakes recommends no packages.

-- no debconf information

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See: http://viff.dk/.

Attachment: pgpLazTpvJrAp.pgp
Description: PGP signature


Reply to: