gh-129843: fix pure Python implementation of warnings.warn_explicit (#129848)

The pure Python implementation of `warnings.warn_explicit` constructs a `WarningMessage`
with an incorrect source (it incorrectly sets the WarningMessage's line to the given `source`).
This commit is contained in:
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) 2025-03-17 16:19:53 +05:30 committed by GitHub
parent ac50ece6ce
commit 80e00ecc39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -422,7 +422,7 @@ def warn_explicit(message, category, filename, lineno,
linecache.getlines(filename, module_globals)
# Print message and context
msg = WarningMessage(message, category, filename, lineno, source)
msg = WarningMessage(message, category, filename, lineno, source=source)
_showwarnmsg(msg)