[Python-bugs-list] [ python-Bugs-788011 ] compiler.compileFile fails on csv.py

SourceForge.net noreply at sourceforge.net
Wed Aug 13 17:45:15 EDT 2003


Bugs item #788011, was opened at 2003-08-13 08:28
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=788011&group_id=5470

Category: Parser/Compiler
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Paul Moore (pmoore)
>Assigned to: Jeremy Hylton (jhylton)
Summary: compiler.compileFile fails on csv.py

Initial Comment:
When trying to compile the files in the standard library, I 
hit a problem compiling (using compiler.compileFile) 
the "csv.py" module. The following is the backtrace:

>>> compileFile("Lib\csv.py")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Apps\Python\lib\compiler\pycodegen.py", line 
42, in compileFile
    mod.compile(display)
  File "C:\Apps\Python\lib\compiler\pycodegen.py", line 
112, in compile
    gen = ModuleCodeGenerator(tree)
  File "C:\Apps\Python\lib\compiler\pycodegen.py", line 
1149, in __init__
    walk(tree, self)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 106, 
in walk
    walker.preorder(tree, visitor)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 63, in 
preorder
    self.dispatch(tree, *args) # XXX *args make sense?
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\pycodegen.py", line 
342, in visitModule
    self.scopes = self.parseSymbols(node)
  File "C:\Apps\Python\lib\compiler\pycodegen.py", line 
255, in parseSymbols
    walk(tree, s)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 106, 
in walk
    walker.preorder(tree, visitor)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 63, in 
preorder
    self.dispatch(tree, *args) # XXX *args make sense?
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\symbols.py", line 207, 
in visitModule
    self.visit(node.node, scope)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\symbols.py", line 258, 
in visitClass
    self.visit(node.code, scope)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\symbols.py", line 220, 
in visitFunction
    self.visit(node.code, scope)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\symbols.py", line 279, 
in visitFor
    self.visit(node.body, scope)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\symbols.py", line 354, 
in visitIf
    self.visit(body, scope)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\symbols.py", line 315, 
in visitAssign
    self.visit(node.expr, scope)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\symbols.py", line 324, 
in visitSubscript
    self.visit(node.expr, scope, 0)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 40, in 
default
    self.dispatch(child, *args)
  File "C:\Apps\Python\lib\compiler\visitor.py", line 57, in 
dispatch
    return meth(node, *args)
TypeError: visitLambda() takes exactly 3 arguments (4 
given)

The script I was using was:

import os
from os.path import join
from compiler import compileFile
for root, dirs, files in os.walk("Lib"):
    for name in files:
        if name.endswith(".py"):
            print join(root, name)
            compileFile(join(root, name))

Is there a better way of compiling all Python source in a 
directory (and its subdirectories)?

----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2003-08-13 19:45

Message:
Logged In: YES 
user_id=11375

Actually it can be boiled down yet further:

f(lambda a, b: (0, 0))[1]

Assigning to Jeremy, because it looks like a compiler/ package 
bug.


----------------------------------------------------------------------

Comment By: A.M. Kuchling (akuchling)
Date: 2003-08-13 19:38

Message:
Logged In: YES 
user_id=11375

The line of code that causes the problem is the following in 
csv.py:

modes[char] = reduce(lambda a, b: (0, a[1] + b[1]),
                     items)[1]


----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-08-13 09:39

Message:
Logged In: YES 
user_id=33168

Take a look at compileall.py in the std library.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=788011&group_id=5470



More information about the Python-bugs-list mailing list