Repository navigation
Conversation
Skip bare "."/".." entries emitted by imports_from_code for `from .. import x` partials: resolving them produced module names with a trailing dot that recursed without bound. Also deduplicate on the resolved module name and record it in visited before recursing, so a submodule is no longer re-walked through every relative-import entry in its parent's __init__.py. Fixes adafruit#275
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
circup install --autocrashes withRecursionErroron packages whose__init__.pyre-exports fromsubmodules.
get_all_importsincircup/command_utils.pyresolves each import to a module name andrecurses, and a bare
.or..carries no module name: the resolution appends nothing, producing aname ending in a dot that resolves back to the same place, so the recursion has no base case.
Two changes. A bare relative entry, one that is nothing but dots, is skipped, since there is no module
named for it to resolve to. And relative paths are resolved explicitly against the current module,
dropping one package level for a leading dot and two for a double dot, rather than being handled by
the same branch as absolute imports.
The
continueafterrequested_installs.appendis the third: an import already matched as arequested install was falling through into the resolution below and being processed twice.
Tests cover a package with a re-exporting
__init__.py, which recursed without bound before.Fixes #275