[Python-checkins] r62787 - python/trunk/Lib/warnings.py

benjamin.peterson python-checkins at python.org
Wed May 7 00:31:52 CEST 2008


Author: benjamin.peterson
Date: Wed May  7 00:31:52 2008
New Revision: 62787

Log:
Make the Python implementation of warnings compatible with the C implementation regarding non-callable showwarning


Modified:
   python/trunk/Lib/warnings.py

Modified: python/trunk/Lib/warnings.py
==============================================================================
--- python/trunk/Lib/warnings.py	(original)
+++ python/trunk/Lib/warnings.py	Wed May  7 00:31:52 2008
@@ -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)
 


More information about the Python-checkins mailing list