From 6dda514ec66697f94b1c1bd3f5f8c47d0b333068 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Tue, 17 Mar 2020 10:00:30 +0100 Subject: [PATCH] Make sure encoding doesn't unnecessarily raise warnings --- jedi/api/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 4d012245..f12372f1 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -122,7 +122,7 @@ class Script(object): also ways to modify the sys path and other things. """ def __init__(self, code=None, line=None, column=None, path=None, - encoding='utf-8', sys_path=None, environment=None, + encoding=None, sys_path=None, environment=None, project=None, source=None): self._orig_path = path # An empty path (also empty string) should always result in no path. @@ -137,7 +137,9 @@ class Script(object): DeprecationWarning, stacklevel=2 ) - if encoding is not None: + if encoding is None: + encoding = 'utf-8' + else: warnings.warn( "Deprecated since version 0.17.0. You should cast to valid " "unicode yourself, especially if you are not using utf-8.",