diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-05-06 22:31:52 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-05-06 22:31:52 (GMT) |
commit | 323c40d48c4c1661a18336af16c59bc279fda571 (patch) | |
tree | a1938a5f6aa2440d9656fea2e5a9247015000ac9 /Lib | |
parent | d29503291013b7dfd70522e776b0c244aff0a264 (diff) | |
download | cpython-323c40d48c4c1661a18336af16c59bc279fda571.zip cpython-323c40d48c4c1661a18336af16c59bc279fda571.tar.gz cpython-323c40d48c4c1661a18336af16c59bc279fda571.tar.bz2 |
Make the Python implementation of warnings compatible with the C implementation regarding non-callable showwarning
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/warnings.py | 3 |
1 files changed, 3 insertions, 0 deletions
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 @@ 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) |