mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Make the Python implementation of warnings compatible with the C implementation regarding non-callable showwarning
This commit is contained in:
parent
d295032910
commit
323c40d48c
1 changed files with 3 additions and 0 deletions
|
@ -278,6 +278,9 @@ def warn_explicit(message, category, filename, lineno,
|
|||
_show_warning(message, category, filename, lineno)
|
||||
else:
|
||||
warn(showwarning_msg, DeprecationWarning)
|
||||
if not callable(showwarning):
|
||||
raise TypeError("warnings.showwarning() must be set to a "
|
||||
"function or method")
|
||||
# Print message and context
|
||||
showwarning(message, category, filename, lineno)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue