]> granicus.if.org Git - python/commitdiff
Make the Python implementation of warnings compatible with the C implementation regar...
authorBenjamin Peterson <benjamin@python.org>
Tue, 6 May 2008 22:31:52 +0000 (22:31 +0000)
committerBenjamin Peterson <benjamin@python.org>
Tue, 6 May 2008 22:31:52 +0000 (22:31 +0000)
Lib/warnings.py

index d9e6e4458722276ca7a04e2f6d384b8b431b76a4..132a34da2873ea377f41ad40b92f7a1136f1d847 100644 (file)
@@ -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)