diff --git a/parso/_compatibility.py b/parso/_compatibility.py index d6ab82a..54ce8f8 100644 --- a/parso/_compatibility.py +++ b/parso/_compatibility.py @@ -14,14 +14,6 @@ except NameError: is_pypy = platform.python_implementation() == 'PyPy' -try: - encoding = sys.stdout.encoding - if encoding is None: - encoding = 'utf-8' -except AttributeError: - encoding = 'ascii' - - def u(string): """Cast to unicode DAMMIT! Written because Python2 repr always implicitly casts to a string, so we diff --git a/parso/tree.py b/parso/tree.py index c1bf759..045cd39 100644 --- a/parso/tree.py +++ b/parso/tree.py @@ -1,7 +1,6 @@ import sys from abc import abstractmethod, abstractproperty -from parso._compatibility import encoding from parso.utils import split_lines @@ -334,8 +333,6 @@ class BaseNode(NodeOrLeaf): def __repr__(self): code = self.get_code().replace('\n', ' ').replace('\r', ' ').strip() - if not sys.version_info.major >= 3: - code = code.encode(encoding, 'replace') return "<%s: %s@%s,%s>" % \ (type(self).__name__, code, self.start_pos[0], self.start_pos[1])