aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-04-09 13:50:59 +0300
committershadchin <shadchin@yandex-team.ru>2022-04-09 13:50:59 +0300
commit67ade9a1ace3bdb3b25b2a8e66cd46d94d89a7be (patch)
tree381a2ec0007a55bc4e06b9727dbb29cc960ad7ce
parent24ac00d7ea42b18cefe755792df13ee4116ad5e7 (diff)
downloadydb-67ade9a1ace3bdb3b25b2a8e66cd46d94d89a7be.tar.gz
Remove unnecessary patch from Python 3
ref:08457aac212d00dad336d739a11d619cf2882ae3
-rw-r--r--contrib/tools/python3/src/Lib/inspect.py4
-rw-r--r--library/python/pytest/plugins/conftests.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/contrib/tools/python3/src/Lib/inspect.py b/contrib/tools/python3/src/Lib/inspect.py
index dd00c21fc2..6f91435541 100644
--- a/contrib/tools/python3/src/Lib/inspect.py
+++ b/contrib/tools/python3/src/Lib/inspect.py
@@ -655,13 +655,13 @@ def cleandoc(doc):
def getfile(object):
"""Work out which source or compiled file an object was defined in."""
if ismodule(object):
- if getattr(object, '__file__', None) is not None:
+ if getattr(object, '__file__', None):
return object.__file__
raise TypeError('{!r} is a built-in module'.format(object))
if isclass(object):
if hasattr(object, '__module__'):
module = sys.modules.get(object.__module__)
- if getattr(module, '__file__', None) is not None:
+ if getattr(module, '__file__', None):
return module.__file__
raise TypeError('{!r} is a built-in class'.format(object))
if ismethod(object):
diff --git a/library/python/pytest/plugins/conftests.py b/library/python/pytest/plugins/conftests.py
index 522041f5a7..3c855c9c11 100644
--- a/library/python/pytest/plugins/conftests.py
+++ b/library/python/pytest/plugins/conftests.py
@@ -11,10 +11,10 @@ orig_getfile = inspect.getfile
def getfile(object):
- res = orig_getfile(object)
- if inspect.ismodule(object):
- if not res and getattr(object, '__orig_file__'):
- res = object.__orig_file__
+ if inspect.ismodule(object) and getattr(object, '__orig_file__', None):
+ res = object.__orig_file__
+ else:
+ res = orig_getfile(object)
return res
inspect.getfile = getfile