[Python-Dev] more pychecker warnings from python-current

Guido van Rossum guido@python.org
Wed, 17 Oct 2001 01:57:26 -0400


> cgi.py:880: Local variable (traceback) not used

I believe this was to avoid a nasty problem when the 'import
traceback' in print_exception() actually has to load the traceback
module (as opposed to finding it already loaded in sys.modules); this
could lose the pending traceback.  I believe that problem is solved now
so this can safely be removed.

> copy_reg.py:47: self is argument in function
> 	not sure if this is really a problem or intended

This is intended -- _reduce() is called by the C method
object.__reduce__ to do the heavy lifing that I didn't want to code in
C (yet).

> copy_reg.py:65: Function return types are inconsistent
> 	line 63 returns tuple of 3, but line 65, returns tuple of 2

This is unfortunately the spec of the __reduce__ function -- it can
return a 2-tuple or a 3-tuple.

> doctest.py:528: Parameter (prefix) not used
> 	docstring says prefix is used, but it isn't

Tim?

> locale.py:358: Redefining attribute (setlocale) original line (68)

This is intentional.  It confused me too.  Note that the previous
locale is stored in _setlocale -- there's a comment about that there.
Still, it's all very confusing.  Martin?

> markupbase.py:31: No class attribute (rawdata) found
> markupbase.py:49: Local variable (sys) not used
> markupbase.py:71: No class attribute (unknown_decl) found
> markupbase.py:86: No class attribute (error) found
> markupbase.py:118: No class attribute (parse_comment) found
> markupbase.py:166: Local variable (n) not used

This is an abstract base class -- these are references to instance
variables of a derived class.  Except for the two "local variable not
used" warnings -- these are relics from the code refactoring that
created the abstract class.  Looks like a job for Fred.

> mhlib.py:651: Local variable (messages) not used
> 	looks like a return in the if clause is necessary, otherwise exception

No, this is done for the side effect of setting self.last (mentioned
in the comment in listmessages()).  I've fixed this by getting rid of
the "messages =" part.

> pickle.py:607: No class attribute (persistent_load) found
> pickle.py:616: No class attribute (persistent_load) found

AFAIK this is intentional; a derived class would have to define
persistent_load() for this feature to work.

> profile.py:356: Local variable (a) not used
> 	on next line, return is not necessary, should a be returned?
> profile.py:368: Local variable (a) not used

Tim?

> xmlrpclib.py:1: Imported module (sys) not used

Fred already fixed this one.

--Guido van Rossum (home page: http://www.python.org/~guido/)