summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index e06a8f4..745b890 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -3214,6 +3214,7 @@ MemoryError_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self = state->memerrors_freelist;
self->args = PyTuple_New(0);
/* This shouldn't happen since the empty tuple is persistent */
+
if (self->args == NULL) {
return NULL;
}
@@ -3229,6 +3230,8 @@ MemoryError_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static void
MemoryError_dealloc(PyBaseExceptionObject *self)
{
+ _PyObject_GC_UNTRACK(self);
+
BaseException_clear(self);
/* If this is a subclass of MemoryError, we don't need to
@@ -3238,8 +3241,6 @@ MemoryError_dealloc(PyBaseExceptionObject *self)
return;
}
- _PyObject_GC_UNTRACK(self);
-
struct _Py_exc_state *state = get_exc_state();
if (state->memerrors_numfree >= MEMERRORS_SAVE) {
Py_TYPE(self)->tp_free((PyObject *)self);