From b9fd84e11cf8342000cafa8b5b3f406606ffcc8d Mon Sep 17 00:00:00 2001 From: Peter Law Date: Sun, 30 Aug 2020 15:48:54 +0100 Subject: [PATCH] Add sanity-check exception Found by mypy while adding types. --- jedi/api/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 946f2c83..0c4db2dc 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -105,6 +105,9 @@ class Script: self.path = path.absolute() if path else None if code is None: + if path is None: + raise ValueError("Must provide at least one of code or path") + # TODO add a better warning than the traceback! with open(path, 'rb') as f: code = f.read()