diff --git a/Lib/warnings.py b/Lib/warnings.py index fc8c0128e3a1eb..3bfba9749abe33 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -409,7 +409,7 @@ def warn_explicit(message, category, filename, lineno, "Unrecognized action (%r) in warnings.filters:\n %s" % (action, item)) # Print message and context - msg = WarningMessage(message, category, filename, lineno, source) + msg = WarningMessage(message, category, filename, lineno, source=source) _showwarnmsg(msg) diff --git a/Misc/NEWS.d/next/Library/2025-03-17-15-45-36.gh-issue-129843.NPdpXL.rst b/Misc/NEWS.d/next/Library/2025-03-17-15-45-36.gh-issue-129843.NPdpXL.rst new file mode 100644 index 00000000000000..c16d61540edf39 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-03-17-15-45-36.gh-issue-129843.NPdpXL.rst @@ -0,0 +1 @@ +Fix incorrect argument passing in :func:`warnings.warn_explicit`.