gh-117535: Change unknown filename of warnings from sys to <sys> (#118018)

This commit is contained in:
Tian Gao 2024-04-18 20:50:09 -07:00 committed by GitHub
parent 398abdd6fa
commit a09e472992
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 6 deletions

View file

@ -332,8 +332,8 @@ def warn(message, category=None, stacklevel=1, source=None,
raise ValueError
except ValueError:
globals = sys.__dict__
filename = "sys"
lineno = 1
filename = "<sys>"
lineno = 0
else:
globals = frame.f_globals
filename = frame.f_code.co_filename