[New-bugs-announce] [issue4525] metaclass fixer fails with AttributeError, causing 2to3 to exit with a traceback

Jean-Paul Calderone report at bugs.python.org
Thu Dec 4 17:37:27 CET 2008


New submission from Jean-Paul Calderone <exarkun at divmod.com>:

I tried running 2to3 on Twisted.  Here's the result:

exarkun at charm:~/Projects/Twisted/trunk$ time
~/Projects/python/branches/release26-maint/python
/home/exarkun/Projects/python/branches/release26-maint/Tools/scripts/2to3 twisted/
> 2to3.patch
/home/exarkun/Projects/Divmod/trunk/Combinator/combinator/xsite.py:7:
DeprecationWarning: the sets module is deprecated
  from sets import Set
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: ws_comma
Traceback (most recent call last):
  File
"/home/exarkun/Projects/python/branches/release26-maint/Tools/scripts/2to3",
line 6, in <module>
    sys.exit(main("lib2to3.fixes"))
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/main.py",
line 92, in main
    rt.refactor(args, options.write, options.doctests_only)
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/refactor.py",
line 196, in refactor
    self.refactor_dir(dir_or_file, write, doctests_only)
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/refactor.py",
line 214, in refactor_dir
    self.refactor_file(fullname, write, doctests_only)
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/refactor.py",
line 237, in refactor_file
    tree = self.refactor_string(input, filename)
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/refactor.py",
line 262, in refactor_string
    self.refactor_tree(tree, name)
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/refactor.py",
line 301, in refactor_tree
    self.traverse_by(self.post_order, tree.post_order())
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/refactor.py",
line 325, in traverse_by
    new = fixer.transform(node, results)
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/fixes/fix_metaclass.py",
line 148, in transform
    if not has_metaclass(node):
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/fixes/fix_metaclass.py",
line 34, in has_metaclass
    return has_metaclass(node)
  File
"/home/exarkun/Projects/python/branches/release26-maint/Lib/lib2to3/fixes/fix_metaclass.py",
line 39, in has_metaclass
    if leaf_node.value == '__metaclass__':
AttributeError: 'Node' object has no attribute 'value'

real    0m32.451s
user    0m31.498s
sys     0m0.140s
exarkun at charm:~/Projects/Twisted/trunk$ 

There's no indication of what it was processing, so I'm not sure what
causes the error.

----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 76893
nosy: exarkun
severity: normal
status: open
title: metaclass fixer fails with AttributeError, causing 2to3 to exit with a traceback
type: crash
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4525>
_______________________________________


More information about the New-bugs-announce mailing list