KEMBAR78
Disallow invalid identifiers from getting implicit bazel __init__.py by nipunn1313 · Pull Request #11268 · python/mypy · GitHub
Skip to content

Conversation

@nipunn1313
Copy link
Contributor

This helps unblock #9636. With namespace packages, the
code to crawl upward would not stop anywhere and would
run into temp directories with invalid module names. Normally
it would stop when it found a dir without an init.py,
but it was placing an implicit fake bazel init there.
Bazeled environments can't really have invalid module name
directories, so this should help fix.

Added tests for namespace-packages and no-namespace-packages

This helps unblock python#9636. With namespace packages, the
code to crawl upward would not stop anywhere and would
run into temp directories with invalid module names. Normally
it would stop when it found a dir without an __init__.py,
but it was placing an implicit fake bazel __init__ there.
Bazeled environments can't really have invalid module name
directories, so this should help fix.

Added tests for namespace-packages and no-namespace-packages
Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

(It looks like we only check .py files here, so we don't have to worry about xxx-stubs being an invalid identifier but valid package)

@hauntsaninja hauntsaninja merged commit 82f767a into python:master Oct 4, 2021
@nipunn1313 nipunn1313 deleted the testcmdlinepkgroot branch October 12, 2021 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants