Fix a small issue that coul dhappen e.g. in stdin.

This commit is contained in:
Dave Halter
2016-07-06 08:05:50 +02:00
parent 24cddda8e7
commit 074a154af3
2 changed files with 4 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ Used only for REPL Completion.
"""
import inspect
import os
from jedi import common
from jedi.parser.fast import FastParser
@@ -105,7 +106,8 @@ def find_syntax_node_name(evaluator, python_object):
except TypeError:
# The type might not be known (e.g. class_with_dict.__weakref__)
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
module = _load_module(evaluator, path, python_object)

View File

@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
import sys
from textwrap import dedent
import jedi
from jedi._compatibility import u, is_py3
from jedi.parser import ParserWithRecovery, load_grammar
from jedi.parser import tree as pt
from textwrap import dedent
def test_user_statement_on_import():