Skip to content

Commit 83cfd46

Browse files
[3.13] gh-129843: fix pure Python implementation of warnings.warn_explicit (GH-129848) (#131349)
gh-129843: fix pure Python implementation of `warnings.warn_explicit` (GH-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`). (cherry picked from commit 80e00ec) Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <[email protected]>
1 parent 3930b7c commit 83cfd46

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/warnings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def warn_explicit(message, category, filename, lineno,
413413
"Unrecognized action (%r) in warnings.filters:\n %s" %
414414
(action, item))
415415
# Print message and context
416-
msg = WarningMessage(message, category, filename, lineno, source)
416+
msg = WarningMessage(message, category, filename, lineno, source=source)
417417
_showwarnmsg(msg)
418418

419419

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix incorrect argument passing in :func:`warnings.warn_explicit`.

0 commit comments

Comments
 (0)