8000 remove un-necessary casts for `MemoryError` · python/cpython@96430d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96430d9

Browse files
committed
remove un-necessary casts for MemoryError
1 parent 11d9e31 commit 96430d9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Objects/exceptions.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3606,23 +3606,23 @@ _PyErr_NoMemory(PyThreadState *tstate)
36063606
}
36073607

36083608
static void
3609-
MemoryError_dealloc(PyObject *obj)
3609+
MemoryError_dealloc(PyObject *op)
36103610
{
3611-
PyBaseExceptionObject *self = (PyBaseExceptionObject *)obj;
3611+
PyBaseExceptionObject *self = _PyBaseExceptionObject_CAST(op);
36123612
_PyObject_GC_UNTRACK(self);
36133613

3614-
BaseException_clear(self);
3614+
(void)BaseException_clear(op);
36153615

36163616
/* If this is a subclass of MemoryError, we don't need to
36173617
* do anything in the free-list*/
36183618
if (!Py_IS_TYPE(self, (PyTypeObject *) PyExc_MemoryError)) {
3619-
Py_TYPE(self)->tp_free((PyObject *)self);
3619+
Py_TYPE(self)->tp_free(op);
36203620
return;
36213621
}
36223622

36233623
struct _Py_exc_state *state = get_exc_state();
36243624
if (state->memerrors_numfree >= MEMERRORS_SAVE) {
3625-
Py_TYPE(self)->tp_free((PyObject *)self);
3625+
Py_TYPE(self)->tp_free(op);
36263626
}
36273627
else {
36283628
self->dict = (PyObject *) state->memerrors_freelist;
@@ -3658,7 +3658,7 @@ free_preallocated_memerrors(struct _Py_exc_state *state)
36583658
while (state->memerrors_freelist != NULL) {
36593659
PyObject *self = (PyObject *) state->memerrors_freelist;
36603660
state->memerrors_freelist = (PyBaseExceptionObject *)state->memerrors_freelist->dict;
3661-
Py_TYPE(self)->tp_free((PyObject *)self);
3661+
Py_TYPE(self)->tp_free(self);
36623662
}
36633663
}
36643664

@@ -3670,10 +3670,10 @@ PyTypeObject _PyExc_MemoryError = {
36703670
0, MemoryError_dealloc, 0, 0, 0, 0, 0, 0, 0,
36713671
0, 0, 0, 0, 0, 0, 0,
36723672
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
3673-
PyDoc_STR("Out of memory."), (traverseproc)BaseException_traverse,
3674-
(inquiry)BaseException_clear, 0, 0, 0, 0, 0, 0, 0, &_PyExc_Exception,
3673+
PyDoc_STR("Out of memory."), BaseException_traverse,
3674+
BaseException_clear, 0, 0, 0, 0, 0, 0, 0, &_PyExc_Exception,
36753675
0, 0, 0, offsetof(PyBaseExceptionObject, dict),
3676-
(initproc)BaseException_init, 0, MemoryError_new
3676+
BaseException_init, 0, MemoryError_new
36773677
};
36783678
PyObject *PyExc_MemoryError = (PyObject *) &_PyExc_MemoryError;
36793679

0 commit comments

Comments
 (0)
0