[issue4405] fix_metaclass broken

Martin v. Löwis report at bugs.python.org
Mon Nov 24 10:02:06 CET 2008


New submission from Martin v. Löwis <martin at v.loewis.de>:

When trying to run 2to3 on Django, I get a traceback

  File "/tmp/py3/lib/python3.0/lib2to3/refactor.py", line 260, in
refactor_string
    self.refactor_tree(tree, name)
  File "/tmp/py3/lib/python3.0/lib2to3/refactor.py", line 299, in
refactor_tree
    self.traverse_by(self.post_order, tree.post_order())
  File "/tmp/py3/lib/python3.0/lib2to3/refactor.py", line 323, in
traverse_by
    new = fixer.transform(node, results)
  File "/tmp/py3/lib/python3.0/lib2to3/fixes/fix_metaclass.py", line
156, in transform
    for suite, i, stmt in find_metas(node):
  File "/tmp/py3/lib/python3.0/lib2to3/fixes/fix_metaclass.py", line
114, in find_metas
    if leaf_node.value == '__metaclass__':
AttributeError: 'Node' object has no attribute 'value'

The smallest example reproducing this is

class Model(object):
    __metaclass__ = ModelBase
    save.alters_data = True

----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 76311
nosy: loewis
severity: normal
status: open
title: fix_metaclass broken
versions: Python 3.0

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


More information about the Python-bugs-list mailing list