[issue46360] Inconsistent import behavior for (unusual) submodules

2022-01-13 Thread Eric Snow
Eric Snow added the comment: > I'm going to assume the "even though sys.modules has `None`" case, > which I think is an oversight and should probably get fixed Yep, I agree. That's the case I was looking at in the first place. I noticed the other two as I was hacking together code to

[issue46360] Inconsistent import behavior for (unusual) submodules

2022-01-13 Thread Brett Cannon
Brett Cannon added the comment: So which inconsistency do you want to change because you listed three and this is only one issue.  I'm going to assume the "even though sys.modules has `None`" case, which I think is an oversight and should probably get fixed, but I also don't know what

[issue46360] Inconsistent import behavior for (unusual) submodules

2022-01-12 Thread Eric Snow
New submission from Eric Snow : Let's look at a hypothetical module "spam" and its submodule "spam.eggs": ``` # spam.py import sys sys.modules['spam.eggs'] = None ``` Then: >>> import spam.eggs >>> import sys >>> sys.modules['spam.eggs'] is None True >>> spam.eggs Traceback (most recent call