Skip to content

bpo-17393: do not convert import of non-package#16826

Closed
romuald wants to merge 1 commit intopython:mainfrom
romuald:lib2to3-fix-non-package-import
Closed

bpo-17393: do not convert import of non-package#16826
romuald wants to merge 1 commit intopython:mainfrom
romuald:lib2to3-fix-non-package-import

Conversation

@romuald
Copy link
Contributor

@romuald romuald commented Oct 16, 2019

In lib2to3, when a patched code is importing a module that has the same
name as a local directory, check that it contains an __init__.py file
before converting it to a local import

Quick example:

fixtures/__init__.py
fixtures/json/things.json

Previously import json was converted to from . import json

https://bugs.python.org/issue17393

In lib2to3, when a patched code is importing a module that has the same
name as a local directory, check that it contains an __init__.py file
before converting it to a local import

Quick example:

```
fixtures/__init__.py
fixtures/json/things.json
```

Previously `import json` was converted to `from . import json`
@encukou
Copy link
Member

encukou commented Feb 18, 2020

I don't feel comfortable reviewing changes here. The other suggested reviewers might also not know too much about lib2to3; they were autoselected by the import keyword.
Adding Benjamin as the lib2to3 expert.

@iritkatriel
Copy link
Member

iritkatriel commented Oct 20, 2021

Closed under bpo-45544.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants