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: 2to3 fails with sympy
Type: behavior Stage: test needed
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: benjamin.peterson, certik, vstinner
Priority: normal Keywords:

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

Messages (7)
msg75669 - (view) Author: Ondřej Čertík (certik) Date: 2008-11-09 23:04
Download my branch of sympy from here:

http://github.com/certik/sympy/tree/division3

and run the 2to3 tool with python2.5:

$ python2.5 ../2to3/2to3 sympy/
[...]
Traceback (most recent call last):
  File "../2to3/2to3", line 6, in <module>
    sys.exit(main("lib2to3.fixes"))
  File "/home/ondra/repos/2to3/lib2to3/main.py", line 126, in main
    rt.refactor(args, options.write, options.doctests_only)
  File "/home/ondra/repos/2to3/lib2to3/refactor.py", line 194, in refactor
    self.refactor_dir(dir_or_file, write, doctests_only)
  File "/home/ondra/repos/2to3/lib2to3/refactor.py", line 212, in
refactor_dir
    self.refactor_file(fullname, write, doctests_only)
  File "/home/ondra/repos/2to3/lib2to3/refactor.py", line 235, in
refactor_file
    tree = self.refactor_string(input, filename)
  File "/home/ondra/repos/2to3/lib2to3/refactor.py", line 260, in
refactor_string
    self.refactor_tree(tree, name)
  File "/home/ondra/repos/2to3/lib2to3/refactor.py", line 299, in
refactor_tree
    self.traverse_by(self.post_order, tree.post_order())
  File "/home/ondra/repos/2to3/lib2to3/refactor.py", line 323, in
traverse_by
    new = fixer.transform(node, results)
  File "/home/ondra/repos/2to3/lib2to3/fixes/fix_metaclass.py", line
148, in transform
    if not has_metaclass(node):
  File "/home/ondra/repos/2to3/lib2to3/fixes/fix_metaclass.py", line 34,
in has_metaclass
    return has_metaclass(node)
  File "/home/ondra/repos/2to3/lib2to3/fixes/fix_metaclass.py", line 39,
in has_metaclass
    if leaf_node.value == '__metaclass__':
AttributeError: 'Node' object has no attribute 'value'
msg75680 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-11-10 03:59
I've fixed the first problem in r67177, but I found another one in
thirdparty/pyglet. Try running with "-x metaclass".
msg75684 - (view) Author: Ondřej Čertík (certik) Date: 2008-11-10 07:04
Thanks, that was quick!

You can delete the thirdparty/pyglet, it's not imported by default. Then
the 2to3 passes. But I found another bug:

issue 4292
msg75686 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-11-10 09:45
You would like to replace "from mptypes import ..." by "from .mptypes 
import ...". Is it really a bug? Python is unable to guess if mptypes, 
functions or settings are "global" modules or "relative" modules. Why 
don't you patch your original code since Python 2.5 also supports this 
syntax? Documentation:
http://www.python.org/doc/2.5.2/ref/import.html
http://docs.python.org/reference/simple_stmts.html#the-import-statement
msg75689 - (view) Author: Ondřej Čertík (certik) Date: 2008-11-10 09:58
Hi Victor, thanks for the comments. I copied them to the issue 4292
where they belong and replied there.
msg75706 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-11-10 21:27
Second metaclass problem fixed in r67178.
msg75709 - (view) Author: Ondřej Čertík (certik) Date: 2008-11-10 22:35
I can confirm this is now fixed. Thanks very much!
History
Date User Action Args
2022-04-11 14:56:41adminsetgithub: 48540
2008-11-10 22:35:46certiksetmessages: + msg75709
2008-11-10 21:27:15benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg75706
2008-11-10 09:59:00certiksetmessages: + msg75689
2008-11-10 09:46:14vstinnersetnosy: + vstinner
messages: + msg75686
2008-11-10 07:04:37certiksetmessages: + msg75684
2008-11-10 03:59:37benjamin.petersonsetmessages: + msg75680
2008-11-09 23:12:31christian.heimessetversions: + Python 2.6
nosy: + benjamin.peterson
priority: normal
assignee: benjamin.peterson
components: + 2to3 (2.x to 3.x conversion tool)
type: behavior
stage: test needed
2008-11-09 23:04:12certikcreate