durusmail: quixote-users: ptl compilation problems
ptl compilation problems
2005-11-21
2005-11-22
ptl compilation problems
Evan Laforge
2005-11-21
This happens with quixote 2.1 and 2.3, under python 2.3 (but not python 2.4):

% cat t.py
import quixote
quixote.enable_ptl()
import bug

% cat bug.ptl
def g():
  f(lambda: None)[1:]

% python2.3 t.py
Traceback (most recent call last): -------
t.py:3 in ?()
        import bug
/home/elaforge/lib/python/quixote/ptl/ptl_import.py:120 in
cModuleImporter.find_import_module(fullname='bug', subname='bug',
path=None)
        return self.loader.load_module(fullname, stuff)
/home/elaforge/lib/python/quixote/ptl/ptl_import.py:100 in
PTLLoader.load_module(name='bug', stuff=(, assign=0)
/var/tmp/python2.3-2.3.5-root/usr/lib/python2.3/compiler/visitor.py:57
in ASTVisitor.dispatch(node=CallFunc(Name('f'), [Lambda((), (), 0,
Name('None'))], None, None), *args=(, 0))
/var/tmp/python2.3-2.3.5-root/usr/lib/python2.3/compiler/visitor.py:40
in ASTVisitor.default(node=CallFunc(Name('f'), [Lambda((), (), 0,
Name('None'))], None, None), *args=(, 0))
/var/tmp/python2.3-2.3.5-root/usr/lib/python2.3/compiler/visitor.py:57
in ASTVisitor.dispatch(node=Lambda((), (), 0, Name('None')),
*args=(, 0))
TypeError: visitLambda() takes exactly 3 arguments (4 given)


The original code that triggered this error is of course more
complicated, but the above was the simplest example I was able to
reduce it to.  I don't really understand why it winds up in a module
in /var/tmp (not using zip imports or anything) but I think that's
unrelated to the problem.

visitLambda wants (self, node, parent), and it looks like that extra 0
comes from visitSlice.  I don't understand enough about how the
compiler stuff works to know immediately what this means.  Maybe a
slice should not have a lambda as a subnode and that is the problem?

In any case, it's gone in 2.4, so maybe it is a 2.3 bug?
reply