warnings.warn_explicit() did not have the proper TypeErrors in place to prevent
bus errors or SystemError being raised. As a side effect of fixing this, a bad
DECREF that could be triggered when 'message' and 'category' were both None was
fixed.
Closes issue 3211. Thanks JP Calderone for the bug report.
diff --git a/Lib/warnings.py b/Lib/warnings.py
index d9e6e44..2e5c512 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -202,6 +202,7 @@
def warn_explicit(message, category, filename, lineno,
module=None, registry=None, module_globals=None):
+ lineno = int(lineno)
if module is None:
module = filename or "<unknown>"
if module[-3:].lower() == ".py":