ITADN

Wildcard imports work in Script.complete but not Interpreter.complete

#2087Openjtbandes 创建于 2026-01-30
J
jtbandescommented
I'm confused by this difference between Script and Interpreter when it comes to `from x import *` imports: ```py >>> jedi.__version__ '0.19.2' >>> jedi.Script("from json import *\ndum").complete(2,3) [<Completion: dump>, <Completion: dumps>] >>> jedi.Interpreter("from json import *\ndum",[]).complete(2,3) [] >>> jedi.Interpreter("from json import dump\ndum",[]).complete(2,3) [<Completion: dump>] ``` I was trying to use Interpreter because I need to supply a custom namespace that contains a global function I'm injecting into the Python environment (it would not appear in the `code`). Is there a way to make Interpreter correctly understand `*` imports, or a different way to inject globals into Script instead?
1 条评论