bpo-17393: do not convert import of non-package by romuald · Pull Request #16826 · python/cpython · GitHub
Skip to content

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

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

romuald wants to merge 1 commit into
python:mainfrom
romuald:lib2to3-fix-non-package-import

Conversation

@romuald

@romuald romuald commented Oct 16, 2019

Copy link
Copy Markdown
Contributor

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

encukou commented Feb 18, 2020

Copy link
Copy Markdown
Member

@iritkatriel

iritkatriel commented Oct 20, 2021

Copy link
Copy Markdown
Member

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