[Python-checkins] cpython (2.7): correct ref counting of default_action (closes #22017)

benjamin.peterson python-checkins at python.org
Sun Jul 20 22:04:49 CEST 2014


http://hg.python.org/cpython/rev/8106f91fccd6
changeset:   91735:8106f91fccd6
branch:      2.7
parent:      91732:9cd3ab7c09d1
user:        Benjamin Peterson <benjamin at python.org>
date:        Sun Jul 20 13:04:11 2014 -0700
summary:
  correct ref counting of default_action (closes #22017)

files:
  Misc/NEWS          |  3 +++
  Python/_warnings.c |  1 +
  2 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,9 @@
 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.
 
diff --git a/Python/_warnings.c b/Python/_warnings.c
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -905,6 +905,7 @@
     _default_action = PyString_FromString("default");
     if (_default_action == NULL)
         return;
+    Py_INCREF(_default_action);
     if (PyModule_AddObject(m, "default_action", _default_action) < 0)
         return;
 }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list