From: Benjamin Peterson Date: Tue, 6 May 2008 22:31:52 +0000 (+0000) Subject: Make the Python implementation of warnings compatible with the C implementation regar... X-Git-Tag: v2.6a3~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=323c40d48c4c1661a18336af16c59bc279fda571;p=python 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 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)