mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-129843: fix pure Python implementation of warnings.warn_explicit
(#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`).
This commit is contained in:
parent
ac50ece6ce
commit
80e00ecc39
2 changed files with 2 additions and 1 deletions
|
@ -422,7 +422,7 @@ def warn_explicit(message, category, filename, lineno,
|
|||
linecache.getlines(filename, module_globals)
|
||||
|
||||
# Print message and context
|
||||
msg = WarningMessage(message, category, filename, lineno, source)
|
||||
msg = WarningMessage(message, category, filename, lineno, source=source)
|
||||
_showwarnmsg(msg)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue