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.

Author kaorihinata
Recipients brett.cannon, eric.smith, kaorihinata
Date 2021-03-14.02:05:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1615687539.48.0.707442248689.issue43477@roundup.psfhosted.org>
In-reply-to
Content
I've spent a bit of time building (and rebuilding) Python 3.9 with a modified `Lib/importlib/_bootstrap.py`/regenerated `importlib.h` to give me some extra logging, and believe the answer I was looking for is `_find_and_load_unlocked`. `_find_and_load_unlocked` appears to load the module in question, and always attach it to the parent regardless of the contents of `fromlist` (`_find_and_load_unlocked` isn't even aware of `fromlist`.) The only real condition seems to be "is there a parent/are we in a package?". `Lib/importlib/_bootstrap.py` is pretty sparsely documented so it's not immediately obvious whether or not some other piece of `importlib` depends on this behavior. If the author is known, then they may be able to give some insight into why the decision was made, and what the best solution would be?
History
Date User Action Args
2021-03-14 02:05:39kaorihinatasetrecipients: + kaorihinata, brett.cannon, eric.smith
2021-03-14 02:05:39kaorihinatasetmessageid: <1615687539.48.0.707442248689.issue43477@roundup.psfhosted.org>
2021-03-14 02:05:39kaorihinatalinkissue43477 messages
2021-03-14 02:05:39kaorihinatacreate