aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Lib/warnings.py
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-07-08 15:54:05 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-07-08 15:54:05 +0000
commitfc7be18c76af2e700641f3598c4856baeef1428e (patch)
tree11dbca45eb321c3a4dd08b12152acc6ef5dd3fa9 /contrib/tools/python3/Lib/warnings.py
parentec0e7ed6da6fb317741fd8468602949a1362eca5 (diff)
parentc92cb9d3a19331916f0c274d80e67f02a62caa9b (diff)
downloadydb-fc7be18c76af2e700641f3598c4856baeef1428e.tar.gz
Merge branch 'rightlib' into mergelibs-240708-1553
Diffstat (limited to 'contrib/tools/python3/Lib/warnings.py')
-rw-r--r--contrib/tools/python3/Lib/warnings.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/tools/python3/Lib/warnings.py b/contrib/tools/python3/Lib/warnings.py
index 391a501f72..fc8c0128e3 100644
--- a/contrib/tools/python3/Lib/warnings.py
+++ b/contrib/tools/python3/Lib/warnings.py
@@ -36,7 +36,9 @@ def _formatwarnmsg_impl(msg):
category = msg.category.__name__
s = f"{msg.filename}:{msg.lineno}: {category}: {msg.message}\n"
- if msg.line is None:
+ # "sys" is a made up file name when we are not able to get the frame
+ # so do not try to get the source line
+ if msg.line is None and msg.filename != "sys":
try:
import linecache
line = linecache.getline(msg.filename, msg.lineno)