summaryrefslogtreecommitdiff
path: root/Lib/warnings.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r--Lib/warnings.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py
index d9e6e44587..132a34da28 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -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)