Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix_metaclass broken #48655

Closed
loewis mannequin opened this issue Nov 24, 2008 · 4 comments
Closed

fix_metaclass broken #48655

loewis mannequin opened this issue Nov 24, 2008 · 4 comments
Assignees

Comments

@loewis
Copy link
Mannequin

loewis mannequin commented Nov 24, 2008

BPO 4405
Nosy @loewis, @birkenfeld, @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/benjaminp'
closed_at = <Date 2008-11-24.22:02:13.675>
created_at = <Date 2008-11-24.09:02:04.800>
labels = ['expert-2to3']
title = 'fix_metaclass broken'
updated_at = <Date 2008-11-24.22:02:13.673>
user = 'https://github.com/loewis'

bugs.python.org fields:

activity = <Date 2008-11-24.22:02:13.673>
actor = 'benjamin.peterson'
assignee = 'benjamin.peterson'
closed = True
closed_date = <Date 2008-11-24.22:02:13.675>
closer = 'benjamin.peterson'
components = ['2to3 (2.x to 3.x conversion tool)']
creation = <Date 2008-11-24.09:02:04.800>
creator = 'loewis'
dependencies = []
files = []
hgrepos = []
issue_num = 4405
keywords = []
message_count = 4.0
messages = ['76311', '76338', '76365', '76367']
nosy_count = 3.0
nosy_names = ['loewis', 'georg.brandl', 'benjamin.peterson']
pr_nums = []
priority = 'high'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue4405'
versions = ['Python 3.0']

@loewis
Copy link
Mannequin Author

loewis mannequin commented Nov 24, 2008

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

@loewis loewis mannequin added the topic-2to3 label Nov 24, 2008
@benjaminp benjaminp self-assigned this Nov 24, 2008
@birkenfeld
Copy link
Member

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.

@loewis
Copy link
Mannequin Author

loewis mannequin commented Nov 24, 2008

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.

@benjaminp
Copy link
Contributor

Fixed in r67371.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants