Email [Python-projects] crashing pylint ;-)

from
Francisco Borges <f.borges at rug dot nl>
subject
[Python-projects] crashing pylint ;-)
date
2005/06/21 14:55
Hello,

the other day I saw an email with Sylvain claiming he had never saw a
program crashing pylint...

Since you guys are dealing with the way pylint imports things, you might
want to look at this:

http://loki.let.rug.nl/optcomp/optcomp-0.5.2.tar.gz

NOTE: PLEASE spare me from bashings on the code quality etc... I'm
actually in the middle of a rewrite but I never find the time to finish
it.

At this code I bootstrap a call to a modified optparse. In order to
avoid including the whole optparse source, I patch its source
on-the-fly.

So if you enter the optcomp-XX/lib/optparse newdirectory it has only a
__init__.py file with this:

#-----------------------------------
import sys, imp, os

thisdir = os.getcwd()
basedir = os.path.abspath(os.path.join(thisdir, '..'))

a = [ i for i in sys.path \
      if os.path.abspath(i) not in [thisdir, basedir] ]

fp, mpath, desc = imp.find_module('optparse',a)
s_opt = imp.load_module('std_optparse', fp, mpath, desc)

for i in s_opt.__all__:
    if i[:2] != '__':
        setattr(sys.modules['optparse'], i, getattr(s_opt, i))

class OptionParser(s_opt.OptionParser):

    def parse_args(self, args=None, values=None, real_optparse=False):
if real_optparse:
            pass
##      return super(OptionParser, self).parse_args()
else:
    import optcomp
    optcomp.completion(self)
#-----------------------------------

If I use

pylint optparse/__init__.py

I get no output, but if instead I do

% cd optparse/
% pylint __init__.py

pylint will lock itself in recursion:

File "/usr/lib/python2.4/site-packages/logilab/common/astng/astng.py",
  line 125, in get_frame
    return node.parent.get_frame()
RuntimeError: maximum recursion depth exceeded

Cheers,
Francisco.

_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects


has reply