This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: modulefinder skips nested modules with same name as top-level bad module
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.snow, jvr, ncoghlan, rdb
Priority: normal Keywords: patch

Created on 2018-12-02 15:00 by rdb, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch.diff rdb, 2018-12-02 15:00 Patch (made against 3.6 branch)
Pull Requests
URL Status Linked Edit
PR 10895 closed rdb, 2018-12-04 15:37
PR 11787 merged brandtbucher, 2019-02-08 03:24
Messages (3)
msg330883 - (view) Author: rdb (rdb) * Date: 2018-12-02 15:00
If modulefinder finds a nested module import (eg. 'import a.b.c') while there is a top-level module with the same name (eg. 'c') that failed to import and got added to the badmodules list, it will skip it entirely without even trying to import it.

This has a trivial fix (attached).  The right thing to do is clearly to check it by fqname in the badmodules dict since that's also what it expects in other locations.

I can make a PR as soon as my CLA gets validated, if that is more convenient.  (Which branch should I make the PR against?)
msg331366 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2018-12-07 23:37
PRs should always be against 'master' unless the issue is already fixed there.
msg339563 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2019-04-07 08:06
Fixed for Python 3.8 via the patch for #35936. We won't be backporting that patch as it also migrates modulefinder from the deprecated imp API to the supported importlib one, and is hence considered overly intrusive for a bug fix release.
History
Date User Action Args
2022-04-11 14:59:08adminsetgithub: 79557
2019-04-07 08:06:56ncoghlansetstatus: open -> closed
versions: - Python 2.7, Python 3.6, Python 3.7
messages: + msg339563

resolution: fixed
stage: patch review -> resolved
2019-02-08 03:24:09brandtbuchersetpull_requests: + pull_request11785
2018-12-07 23:37:45brett.cannonsetnosy: - brett.cannon
2018-12-07 23:37:37brett.cannonsetnosy: + brett.cannon
messages: + msg331366
2018-12-07 23:36:50brett.cannonsetnosy: + jvr
2018-12-07 23:36:38brett.cannonsetnosy: - brett.cannon
2018-12-04 15:39:48rdbsetpull_requests: - pull_request10133
2018-12-04 15:37:38rdbsetpull_requests: + pull_request10134
2018-12-04 15:25:52rdbsetpull_requests: + pull_request10133
2018-12-02 15:45:17SilentGhostsetnosy: + brett.cannon, ncoghlan, eric.snow
stage: patch review

versions: - Python 3.4, Python 3.5
2018-12-02 15:00:55rdbcreate