Bug report
Bug description:
Problem takes multiple files to demo, so I've put it in a gist https://gist.github.com/msullivan/90996c05e8c8e01c2492d1c657b59d52. If you put all those files in test and run python3 -m test.lazy_lol, I get:
importer='__main__' name='' fromlist=('go',)
importer='test.go' name='uhoh' fromlist=('x',)
The problem is that the filter gets a relative path, but nothing indicates that, so there is no way to distinguish between from uhoh import x and from .uhoh import x.
The PEP doesn't really touch on what the right thing is here.
Potential fixes:
- Put a leading
. in the name, so .uhoh in that case
- Turn it into a fully resolved path, so
test.uhoh. (Assuming we have the info to do it at that point? I haven't looked carefully yet)
One other snag is that if option 1 is chosen, we still wouldn't be able to resolve the location when the importer is __main__ (unless we could also change that).
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Bug report
Bug description:
Problem takes multiple files to demo, so I've put it in a gist https://gist.github.com/msullivan/90996c05e8c8e01c2492d1c657b59d52. If you put all those files in
testand runpython3 -m test.lazy_lol, I get:The problem is that the filter gets a relative path, but nothing indicates that, so there is no way to distinguish between
from uhoh import xandfrom .uhoh import x.The PEP doesn't really touch on what the right thing is here.
Potential fixes:
.in thename, so.uhohin that casetest.uhoh. (Assuming we have the info to do it at that point? I haven't looked carefully yet)One other snag is that if option 1 is chosen, we still wouldn't be able to resolve the location when the importer is
__main__(unless we could also change that).CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux