summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorEddie Elizondo <eduardo.elizondorueda@gmail.com>2019-03-27 11:52:18 (GMT)
committerPetr Viktorin <encukou@gmail.com>2019-03-27 11:52:18 (GMT)
commit364f0b0f19cc3f0d5e63f571ec9163cf41c62958 (patch)
tree977c0c418780824cca9ef9b4d920b9d423253e84 /Modules
parent1fc5bf2ff27b898e8d9460d0fbc791e83009ed71 (diff)
downloadcpython-364f0b0f19cc3f0d5e63f571ec9163cf41c62958.zip
cpython-364f0b0f19cc3f0d5e63f571ec9163cf41c62958.tar.gz
cpython-364f0b0f19cc3f0d5e63f571ec9163cf41c62958.tar.bz2
bpo-35810: Incref heap-allocated types in PyObject_Init (GH-11661)
* Incref heap-allocated types in PyObject_Init * Add documentation and porting notes to What's New
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_curses_panel.c6
-rw-r--r--Modules/_tkinter.c3
2 files changed, 5 insertions, 4 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index e7bbefd..53849e3 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -250,7 +250,10 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
static void
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
{
- PyObject *obj = (PyObject *) panel_userptr(po->pan);
+ PyObject *tp, *obj;
+
+ tp = (PyObject *) Py_TYPE(po);
+ obj = (PyObject *) panel_userptr(po->pan);
if (obj) {
(void)set_panel_userptr(po->pan, NULL);
Py_DECREF(obj);
@@ -261,6 +264,7 @@ PyCursesPanel_Dealloc(PyCursesPanelObject *po)
remove_lop(po);
}
PyObject_DEL(po);
+ Py_DECREF(tp);
}
/* panel_above(NULL) returns the bottom panel in the stack. To get
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index a96924c..613a95b 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -617,7 +617,6 @@ Tkapp_New(const char *screenName, const char *className,
v = PyObject_New(TkappObject, (PyTypeObject *) Tkapp_Type);
if (v == NULL)
return NULL;
- Py_INCREF(Tkapp_Type);
v->interp = Tcl_CreateInterp();
v->wantobjects = wantobjects;
@@ -802,7 +801,6 @@ newPyTclObject(Tcl_Obj *arg)
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;
@@ -2722,7 +2720,6 @@ Tktt_New(PyObject *func)
v = PyObject_New(TkttObject, (PyTypeObject *) Tktt_Type);
if (v == NULL)
return NULL;
- Py_INCREF(Tktt_Type);
Py_INCREF(func);
v->token = NULL;