]> granicus.if.org Git - python/commitdiff
correct ref counting of default_action (closes #22017)
authorBenjamin Peterson <benjamin@python.org>
Sun, 20 Jul 2014 20:04:11 +0000 (13:04 -0700)
committerBenjamin Peterson <benjamin@python.org>
Sun, 20 Jul 2014 20:04:11 +0000 (13:04 -0700)
Misc/NEWS
Python/_warnings.c

index d2fc3e2938171ffac13d6ad78a0838078dc6e4d3..efad9ea24100eddcc88ced39007862c9bb9e7bd5 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #22017: Correct reference counting errror in the initialization of the
+  _warnings module.
+
 - Issue 21044: tarfile.open() now handles fileobj with an integer 'name'
   attribute.  Based on patch by Martin Panter.
 
index 445ff6ba9e45e9b7a103627a1a9a4f1ff8d284f5..92d6547a7cd9854a2dc669c953e3079dc7465849 100644 (file)
@@ -905,6 +905,7 @@ _PyWarnings_Init(void)
     _default_action = PyString_FromString("default");
     if (_default_action == NULL)
         return;
+    Py_INCREF(_default_action);
     if (PyModule_AddObject(m, "default_action", _default_action) < 0)
         return;
 }