Skip to content

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

@jtbandes

Description

@jtbandes

I'm confused by this difference between Script and Interpreter when it comes to from x import * imports:

>>> 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions