8000 [3.12] gh-129843: fix pure Python implementation of `warnings.warn_ex… · python/cpython@e5e8b8a · GitHub
[go: up one dir, main page]

Skip to content

Commit e5e8b8a

Browse files
[3.12] gh-129843: fix pure Python implementation of warnings.warn_explicit (GH-129848) (#131350)
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 (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <thatiparthysreenivas@gmail.com>
1 parent baea0e2 commit e5e8b8a

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
@@ -409,7 +409,7 @@ def warn_explicit(message, category, filename, lineno,
409409
"Unrecognized action (%r) in warnings.filters:\n %s" %
410410
(action, item))
411411
# Print message and context
412-
msg = WarningMessage(message, category, filename, lineno, source)
412+
msg = WarningMessage(message, category, filename, lineno, source=source)
413413
_showwarnmsg(msg)
414414

415415

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)
0