[Python-checkins] cpython (merge default -> default): Merge heads

terry.reedy python-checkins at python.org
Sun Aug 11 00:40:33 CEST 2013


http://hg.python.org/cpython/rev/febe4f36e020
changeset: 85116:febe4f36e020
parent: 85115:d9a9fe5e700d
parent: 85111:4d0c938870bc
user: Terry Jan Reedy <tjreedy at udel.edu>
date: Sat Aug 10 18:33:37 2013 -0400
summary:
 Merge heads
files:
 Misc/NEWS | 2 ++
 Modules/_tkinter.c | 9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,8 @@
 - Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get
 docstrings and ValueError messages. Patch by Zhongyue Luo
 
+- Fix refcounting issue with extension types in tkinter.
+
 - Issue #8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error
 if methods have annotations; it now correctly displays the annotations.
 
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -516,6 +516,7 @@
 v = PyObject_New(TkappObject, (PyTypeObject *) Tkapp_Type);
 if (v == NULL)
 return NULL;
+ Py_INCREF(Tkapp_Type);
 
 v->interp = Tcl_CreateInterp();
 v->wantobjects = wantobjects;
@@ -674,6 +675,7 @@
 self = PyObject_New(PyTclObject, (PyTypeObject *) PyTclObject_Type);
 if (self == NULL)
 return NULL;
+ Py_INCREF(PyTclObject_Type);
 Tcl_IncrRefCount(arg);
 self->value = arg;
 self->string = NULL;
@@ -683,9 +685,11 @@
 static void
 PyTclObject_dealloc(PyTclObject *self)
 {
+ PyObject *tp = (PyObject *) Py_TYPE(self);
 Tcl_DecrRefCount(self->value);
 Py_XDECREF(self->string);
 PyObject_Del(self);
+ Py_DECREF(tp);
 }
 
 static char*
@@ -2196,6 +2200,7 @@
 v = PyObject_New(TkttObject, (PyTypeObject *) Tktt_Type);
 if (v == NULL)
 return NULL;
+ Py_INCREF(Tktt_Type);
 
 Py_INCREF(func);
 v->token = NULL;
@@ -2211,10 +2216,12 @@
 {
 TkttObject *v = (TkttObject *)self;
 PyObject *func = v->func;
+ PyObject *tp = (PyObject *) Py_TYPE(self);
 
 Py_XDECREF(func);
 
 PyObject_Del(self);
+ Py_DECREF(tp);
 }
 
 static PyObject *
@@ -2520,11 +2527,13 @@
 static void
 Tkapp_Dealloc(PyObject *self)
 {
+ PyObject *tp = (PyObject *) Py_TYPE(self);
 /*CHECK_TCL_APPARTMENT;*/
 ENTER_TCL
 Tcl_DeleteInterp(Tkapp_Interp(self));
 LEAVE_TCL
 PyObject_Del(self);
+ Py_DECREF(tp);
 DisableEventHook();
 }
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /