.pycharm_helpers/third_party/thriftpy/_shaded_thriftpy/_compat.py
直接用下面的代码替换原文件代码即可
# -*- coding: utf-8 -*-
"""
thriftpy._compat
~~~~~~~~~~~~~
py2/py3 compatibility support.
"""
from __future__ import absolute_import
import platform
import sys
import types
PY3 = sys.version_info[0] == 3
PYPY = "__pypy__" in sys.modules
JYTHON = sys.platform.startswith("java")
UNIX = platform.system() in ("Linux", "Darwin")
CYTHON = False # Cython always disabled in pypy and windows
# only python2.7.9 and python 3.4 or above have true ssl context
MODERN_SSL = (2, 7, 9) <= sys.version_info < (3, 0, 0) or \
sys.version_info >= (3, 4)
if PY3:
text_type = str
string_types = (str,)
def u(s):
return s
else:
text_type = unicode # noqa
string_types = (str, unicode) # noqa
def u(s):
if not isinstance(s, text_type):
s = s.decode("utf-8")
return s
# `LOAD_ATTR` constants of `org.python.core.Opcode` class differs in Jython 2.7.0 and Jython 2.7.1
# <= Jython 2.7.1b3
# `Opcode` class in Jython 2.7.0 has the comment: "derived from CPython 2.5.2 Include/opcode.h"
JYTHON_2_7_0_LOAD_ATTR = 105
# >= Jython 2.7.1rc1
# `Opcode` class in Jython 2.7.1 has the comment: "derived from CPython 2.7.12 I