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>
This commit is contained in:
Xtreak 2019-03-01 22:47:55 +05:30 committed by Victor Stinner
parent 91b9ecf82c
commit be7c460fb5
3 changed files with 22 additions and 1 deletions

View file

@ -124,7 +124,7 @@ def _formatwarnmsg(msg):
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,