msg75683 - (view) |
Author: Ondřej Čertík (certik) |
Date: 2008-11-10 07:03 |
While converting the SymPy repo: the 2to3 failed to convert stuff like: from something import (a, b, c, ) Attached find the patch that I had to do by hand -- I think 2to3 should be able to fix this as well. |
|
|
msg75687 - (view) |
Author: Ondřej Čertík (certik) |
Date: 2008-11-10 09:56 |
Author: STINNER Victor (haypo): 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 |
|
|
msg75688 - (view) |
Author: Ondřej Čertík (certik) |
Date: 2008-11-10 09:58 |
> You would like to replace "from mptypes import ..." by "from .mptypes > import ...". Yes, exactly, see the patch where I did that. > Is it really a bug? Python is unable to guess if mptypes, > functions or settings are "global" modules or "relative" modules. I think it is a bug, because 2to3 correctly fixed all the other import statements, like "from something import a, b, c", but failed with "from something import (a, b, c)". > Why don't you patch your original code since Python 2.5 also > supports this syntax? Because we need to support python2.4, a lot of people still use it. |
|
|
msg75690 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2008-11-10 10:45 |
Ooops, I replied to the wrong issue (#4292) :-p My test was wrong: yes, 2to3 needs a patch. I wrote one (with no test yet). |
|
|
msg75707 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2008-11-10 21:31 |
Fixed in r67179. Ondrej, thanks for running 2to3 over sympy and finding all these tasty bugs! |
|
|
msg75708 - (view) |
Author: Ondřej Čertík (certik) |
Date: 2008-11-10 22:34 |
Benjamin, thanks for the fantastic work! I discovered more bugs, but this time I reported to the py3000 list, as I need more feedback on it. But it seems you'll get another tasty bug for the 2to3, among other things. :) |
|
|