This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: fix_metaclass broken
Type: Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: benjamin.peterson, georg.brandl, loewis
Priority: high Keywords:

Created on 2008-11-24 09:02 by loewis, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg76311 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-11-24 09:02
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
msg76338 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-11-24 16:52
Are you sure you run the latest 2to3? I ran it over docutils last night,
and while the version distributed with 2.6 failed with the same
exception, the current 2to3 from the sandbox worked.
msg76365 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-11-24 21:40
> Are you sure you run the latest 2to3? I ran it over docutils last night,
> and while the version distributed with 2.6 failed with the same
> exception, the current 2to3 from the sandbox worked.

I was using the one included in the py3k branch (in r67369), which goes
up to r66985 from the 2to3 project.
msg76367 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-11-24 22:02
Fixed in r67371.
History
Date User Action Args
2022-04-11 14:56:41adminsetgithub: 48655
2008-11-24 22:02:13benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg76367
2008-11-24 21:40:02loewissetmessages: + msg76365
2008-11-24 16:52:10georg.brandlsetnosy: + georg.brandl
messages: + msg76338
2008-11-24 12:53:12benjamin.petersonsetpriority: high
assignee: benjamin.peterson
nosy: + benjamin.peterson
2008-11-24 09:02:04loewiscreate