mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-10 07:41:51 +08:00
Fix a small issue that coul dhappen e.g. in stdin.
This commit is contained in:
@@ -3,6 +3,7 @@ Used only for REPL Completion.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
|
import os
|
||||||
|
|
||||||
from jedi import common
|
from jedi import common
|
||||||
from jedi.parser.fast import FastParser
|
from jedi.parser.fast import FastParser
|
||||||
@@ -105,7 +106,8 @@ def find_syntax_node_name(evaluator, python_object):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
# The type might not be known (e.g. class_with_dict.__weakref__)
|
# The type might not be known (e.g. class_with_dict.__weakref__)
|
||||||
return None
|
return None
|
||||||
if path is None:
|
if path is None or not os.path.exists(path):
|
||||||
|
# The path might not exist or be e.g. <stdin>.
|
||||||
return None
|
return None
|
||||||
|
|
||||||
module = _load_module(evaluator, path, python_object)
|
module = _load_module(evaluator, path, python_object)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import sys
|
import sys
|
||||||
|
from textwrap import dedent
|
||||||
|
|
||||||
import jedi
|
import jedi
|
||||||
from jedi._compatibility import u, is_py3
|
from jedi._compatibility import u, is_py3
|
||||||
from jedi.parser import ParserWithRecovery, load_grammar
|
from jedi.parser import ParserWithRecovery, load_grammar
|
||||||
from jedi.parser import tree as pt
|
from jedi.parser import tree as pt
|
||||||
from textwrap import dedent
|
|
||||||
|
|
||||||
|
|
||||||
def test_user_statement_on_import():
|
def test_user_statement_on_import():
|
||||||
|
|||||||
Reference in New Issue
Block a user