bpo-35178: Fix warnings._formatwarnmsg() (GH-12033)
Ensure custom formatwarning function can receive line as positional argument.
Co-Authored-By: Tashrif Billah <tashrifbillah@gmail.com>
(cherry picked from commit be7c460fb50efe3b88a00281025d76acc62ad2fd)
Co-authored-by: Xtreak <tir.karthi@gmail.com>
diff --git a/Lib/warnings.py b/Lib/warnings.py
index ae4295e..9064f56 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -124,7 +124,7 @@
if fw is not _formatwarning_orig:
# warnings.formatwarning() was replaced
return fw(msg.message, msg.category,
- msg.filename, msg.lineno, line=msg.line)
+ msg.filename, msg.lineno, msg.line)
return _formatwarnmsg_impl(msg)
def filterwarnings(action, message="", category=Warning, module="", lineno=0,