diff options
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r-- | Lib/warnings.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py index c95ffc3..9353bfa 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -247,6 +247,9 @@ def warn_explicit(message, category, filename, lineno, raise RuntimeError( "Unrecognized action (%r) in warnings.filters:\n %s" % (action, item)) + if not hasattr(showwarning, "__call__"): + raise TypeError("warnings.showwarning() must be set to a " + "function or method") # Print message and context showwarning(message, category, filename, lineno) |