Make the Python implementation of warnings compatible with the C implementation regarding non-callable showwarning
diff --git a/Lib/warnings.py b/Lib/warnings.py
index d9e6e44..132a34d 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -278,6 +278,9 @@
_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)