diff options
author | Michael W. Hudson <mwh@python.net> | 2003-08-07 14:58:10 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2003-08-07 14:58:10 (GMT) |
commit | e723e453a1f11f4865f25d93d3cf20280d9f831a (patch) | |
tree | ca1ffcac4e71addc3e0cab18a108d1964da51180 /Objects | |
parent | bb18f620ad11c0536c36df54ee86fc21fd05f9ec (diff) | |
download | cpython-e723e453a1f11f4865f25d93d3cf20280d9f831a.zip cpython-e723e453a1f11f4865f25d93d3cf20280d9f831a.tar.gz cpython-e723e453a1f11f4865f25d93d3cf20280d9f831a.tar.bz2 |
Repair refcounting on error return from type_set_bases.
Include a test case that failed for one of my efforts to repair this.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 60c4fbc..2a7df8a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -303,13 +303,16 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context) return r; bail: + Py_DECREF(type->tp_bases); + Py_DECREF(type->tp_base); + if (type->tp_mro != old_mro) { + Py_DECREF(type->tp_mro); + } + type->tp_bases = old_bases; type->tp_base = old_base; type->tp_mro = old_mro; - Py_DECREF(value); - Py_DECREF(new_base); - return -1; } |