mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Make sure encoding doesn't unnecessarily raise warnings
This commit is contained in:
@@ -122,7 +122,7 @@ class Script(object):
|
|||||||
also ways to modify the sys path and other things.
|
also ways to modify the sys path and other things.
|
||||||
"""
|
"""
|
||||||
def __init__(self, code=None, line=None, column=None, path=None,
|
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):
|
project=None, source=None):
|
||||||
self._orig_path = path
|
self._orig_path = path
|
||||||
# An empty path (also empty string) should always result in no path.
|
# An empty path (also empty string) should always result in no path.
|
||||||
@@ -137,7 +137,9 @@ class Script(object):
|
|||||||
DeprecationWarning,
|
DeprecationWarning,
|
||||||
stacklevel=2
|
stacklevel=2
|
||||||
)
|
)
|
||||||
if encoding is not None:
|
if encoding is None:
|
||||||
|
encoding = 'utf-8'
|
||||||
|
else:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"Deprecated since version 0.17.0. You should cast to valid "
|
"Deprecated since version 0.17.0. You should cast to valid "
|
||||||
"unicode yourself, especially if you are not using utf-8.",
|
"unicode yourself, especially if you are not using utf-8.",
|
||||||
|
|||||||
Reference in New Issue
Block a user