Issue19510
Created on 2013-11-06 00:27 by durin42, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg202248 - (view) | Author: Augie Fackler (durin42) * | Date: 2013-11-06 00:27 | |
While tinkering (again) with Mercurial Python 3 messes, I ran across this gem: import error, osutil, encoding, collections (http://selenic.com/hg/file/e1317d3e59e1/mercurial/util.py#l17) That import statement contains 3 relative imports (that is, mercurial.error, mercurial.osutil, and mercurial.encoding), and one standard library import (collections). Because of the standard lib import on that line, lib2to3 doesn't rewrite any of the imports. If I instead move collections to its own line, then the first three imports get correctly rewritten to the "from . import error" form. I've got Python 3.3.2 locally, and the lib2to3 is the one from that stdlib. |
|||
| msg213587 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2014-03-14 19:32 | |
To be fair to 2to3, that line disrespects some Python best practices (use explicit relative imports (2.5+), put one import per line, group imports by stdlib/non-stdlib). It’s still a bug though :) |
|||
| msg355637 - (view) | Author: Batuhan Taskaya (BTaskaya) * ![]() |
Date: 2019-10-29 09:46 | |
> It’s still a bug though :)
It gives a warning about this though
RefactoringTool: ### In file test/t.py ###
RefactoringTool: Line 1: absolute and local imports together
If it still counts as a bug, let me know and i'll try to prepare a patch.
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:53 | admin | set | github: 63709 |
| 2021-10-20 22:57:09 | iritkatriel | set | status: open -> closed superseder: Close 2to3 issues and list them here resolution: wont fix stage: resolved |
| 2019-10-29 09:46:15 | BTaskaya | set | nosy:
+ BTaskaya messages: + msg355637 |
| 2014-03-14 19:32:26 | eric.araujo | set | nosy:
+ eric.araujo, benjamin.peterson messages: + msg213587 |
| 2013-11-06 00:27:39 | durin42 | create | |
