First of all, thanks for the tool. It looks like it will be very helpful.
I’m having a problem with global variables. The OS is Suse Linux.
The following module causes pylint to raise a recursion exception.
--- begin ---
"""This module causes 'RuntimeError: maximum recursion depth exceeded'
pylint 0.9.0,
astng 0.14.0, common 0.13.0
Python 2.3.4 (#1, Oct 5 2004, 00:26:51)
[GCC 3.3.4 (pre 3.3.5 20040809)]
"""
__revision__ = 1.0
class MyClass:
"""The name of this class does not affect the problem."""
def __init__(self, val):
self.val = val
def set(self, val):
"""Any function will cause the problem."""
self.val = val
obj = myclass(3)
def doit():
"""This function is where pylint fails.
Getting rid of the 'global' allows pylint to run to completion.
Referencing obj.val does not seem to cause a problem.
"""
global obj
obj.set(5)
# Defining obj here causes the same problem.
# obj = myclass(3)
--- end ---
Stderr (with a bunch of repeats edited out) looks like this:
No config file found, using default configuration
Traceback (most recent call last):
File "/usr/bin/pylint", line 4, in ?
lint.Run(sys.argv[1:])
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 773, in __init__
linter.check(args)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 435, in check
self.check_file(filepath, modname, checkers)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 449, in check_file
astng = self._check_file(filepath, modname, checkers)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 473, in _check_file
self.check_astng_module(astng, checkers)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 517, in check_astng_module
self.astng_events(astng, [checker for checker in checkers
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 534, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 534, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 534, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 534, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 534, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 534, in astng_events
self.astng_events(child, checkers, _reversed_checkers)
File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 536, in astng_events
checker.leave(astng)
File "/usr/lib/python2.3/site-packages/logilab/astng/utils.py", line 92, in leave
method(node)
File "/usr/lib/python2.3/site-packages/pylint/checkers/variables.py", line 322, in leave_getattr
module = node.expr.infer().next()
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 63, in wrapped
for res in _func(node, name, path, **kwargs):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 81, in _infer_stmts
for infered in stmt.infer(stmt._infer_name(frame, name), path):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 63, in wrapped
for res in _func(node, name, path, **kwargs):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 251, in infer_global
yield self.root().resolve(name)
File "/usr/lib/python2.3/site-packages/logilab/astng/nodes.py", line 277, in resolve
return stmt.infer(stmt._infer_name(frame, name), path).next()
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 63, in wrapped
for res in _func(node, name, path, **kwargs):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 251, in infer_global
yield self.root().resolve(name)
File "/usr/lib/python2.3/site-packages/logilab/astng/nodes.py", line 277, in resolve
return stmt.infer(stmt._infer_name(frame, name), path).next()
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 63, in wrapped
for res in _func(node, name, path, **kwargs):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 251, in infer_global
yield self.root().resolve(name)
... Repeats ...
return stmt.infer(stmt._infer_name(frame, name), path).next()
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 63, in wrapped
for res in _func(node, name, path, **kwargs):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 81, in _infer_stmts
for infered in stmt.infer(stmt._infer_name(frame, name), path):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 63, in wrapped
for res in _func(node, name, path, **kwargs):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 169, in infer_callfunc
for callee in self.node.infer(name, path):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 63, in wrapped
for res in _func(node, name, path, **kwargs):
File "/usr/lib/python2.3/site-packages/logilab/astng/inference.py", line 139, in infer_name
frame, stmts = self.lookup_name(self.name)
File "/usr/lib/python2.3/site-packages/logilab/astng/nodes.py", line 228, in lookup_name
frame = self.frame()
File "/usr/lib/python2.3/site-packages/logilab/astng/nodes.py", line 116, in frame
return self.parent.frame()
File "/usr/lib/python2.3/site-packages/logilab/astng/nodes.py", line 116, in frame
return self.parent.frame()
File "/usr/lib/python2.3/site-packages/logilab/astng/nodes.py", line 116, in frame
return self.parent.frame()
File "/usr/lib/python2.3/site-packages/logilab/astng/nodes.py", line 116, in frame
return self.parent.frame()
RuntimeError: maximum recursion depth exceeded
Let me know if there is any other information which would be useful.
Kevin Hart
Vadatech, inc.
Re: [Python-projects] pylint crashing due to 'global'
