Skip to content

Commit

Permalink
pythongh-111178: fix some USAN failures - mismatched function pointers (
Browse files Browse the repository at this point in the history
  • Loading branch information
picnixz authored Sep 27, 2024
1 parent 0e21cc6 commit 702c4a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -3387,8 +3387,9 @@ _PyErr_NoMemory(PyThreadState *tstate)
}

static void
MemoryError_dealloc(PyBaseExceptionObject *self)
MemoryError_dealloc(PyObject *obj)
{
PyBaseExceptionObject *self = (PyBaseExceptionObject *)obj;
_PyObject_GC_UNTRACK(self);

BaseException_clear(self);
Expand Down Expand Up @@ -3447,7 +3448,7 @@ PyTypeObject _PyExc_MemoryError = {
PyVarObject_HEAD_INIT(NULL, 0)
"MemoryError",
sizeof(PyBaseExceptionObject),
0, (destructor)MemoryError_dealloc, 0, 0, 0, 0, 0, 0, 0,
0, MemoryError_dealloc, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
PyDoc_STR("Out of memory."), (traverseproc)BaseException_traverse,
Expand Down
6 changes: 3 additions & 3 deletions Objects/rangeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)


static PyObject *
range_vectorcall(PyTypeObject *type, PyObject *const *args,
range_vectorcall(PyObject *rangetype, PyObject *const *args,
size_t nargsf, PyObject *kwnames)
{
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
if (!_PyArg_NoKwnames("range", kwnames)) {
return NULL;
}
return range_from_array(type, args, nargs);
return range_from_array((PyTypeObject *)rangetype, args, nargs);
}

PyDoc_STRVAR(range_doc,
Expand Down Expand Up @@ -803,7 +803,7 @@ PyTypeObject PyRange_Type = {
0, /* tp_init */
0, /* tp_alloc */
range_new, /* tp_new */
.tp_vectorcall = (vectorcallfunc)range_vectorcall
.tp_vectorcall = range_vectorcall
};

/*********************** range Iterator **************************/
Expand Down
5 changes: 3 additions & 2 deletions Objects/tupleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,8 +999,9 @@ tupleiter_traverse(_PyTupleIterObject *it, visitproc visit, void *arg)
}

static PyObject *
tupleiter_next(_PyTupleIterObject *it)
tupleiter_next(PyObject *obj)
{
_PyTupleIterObject *it = (_PyTupleIterObject *)obj;
PyTupleObject *seq;
PyObject *item;

Expand Down Expand Up @@ -1101,7 +1102,7 @@ PyTypeObject PyTupleIter_Type = {
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
PyObject_SelfIter, /* tp_iter */
(iternextfunc)tupleiter_next, /* tp_iternext */
tupleiter_next, /* tp_iternext */
tupleiter_methods, /* tp_methods */
0,
};
Expand Down

0 comments on commit 702c4a2

Please sign in to comment.