Share

PyChecker

Tracker: Bugs

5 Spurious warning with generators - ID: 2008061
Last Update: Comment added ( nnorwitz )

If a function uses more than one generator expression, pychecker 0.8.17
appears to think the second and subsequent ones are redefinitions, and
raises a warning. I've attached a very small python source file that shows
the problem (genexpr_test.py).

This is on python 2.5.2 running on OS X 10.3.9.

Dave Opstad
mailto: dave.opstad@monotypeimaging.com


Nobody/Anonymous ( nobody ) - 2008-07-01 17:40

5

Closed

Fixed

Nobody/Anonymous

None

None

Public


Comments ( 3 )




Date: 2008-11-17 06:06
Sender: nnorwitzProject Admin

Yup, I never updated pychecker much to handle generator expressions. Let
me know if you find more problems. This one is fixed:

Checking in test_expected/test103;
initial revision: 1.1
Checking in test_input/test103.py;
initial revision: 1.1
Checking in pychecker/CodeChecks.py;
new revision: 1.176; previous revision: 1.175
Checking in pychecker/utils.py;
new revision: 1.12; previous revision: 1.11



Date: 2008-07-31 19:59
Sender: andy-chu


I also hit this bug:

self._include_labels = frozenset(label.lower() for label in
include_labels)
self._exclude_labels = frozenset(label.lower() for label in
exclude_labels)

demetrius/googleprojectlist.py:42: Redefining attribute (<generator
expression>) original line (41)




Date: 2008-07-15 01:16
Sender: pronovic


This seems to be basically the same problem as reported in Debian bug
#408261:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=408261

That bug report uses the following code:

def main():
' '.join(str(x) for x in range(10))
' '.join(str(x) for x in range(11))

It gets a similar result:

bug.py:3: Redefining attribute (<generator expression>) original line
(2)


Log in to comment.

Attached File ( 1 )

Filename Description Download
genexpr_test.py test case showing genexpr problem Download

Changes ( 4 )

Field Old Value Date By
status_id Open 2008-11-17 06:06 nnorwitz
resolution_id None 2008-11-17 06:06 nnorwitz
close_date - 2008-11-17 06:06 nnorwitz
File Added 283329: genexpr_test.py 2008-07-01 17:40 nobody