mirror of
https://github.com/python/cpython.git
synced 2024-11-27 03:45:08 +08:00
gh-111178: fix some USAN failures - mismatched function pointers (GH-123004)
This commit is contained in:
parent
0e21cc6cf8
commit
702c4a2473
@ -3387,8 +3387,9 @@ _PyErr_NoMemory(PyThreadState *tstate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
MemoryError_dealloc(PyBaseExceptionObject *self)
|
MemoryError_dealloc(PyObject *obj)
|
||||||
{
|
{
|
||||||
|
PyBaseExceptionObject *self = (PyBaseExceptionObject *)obj;
|
||||||
_PyObject_GC_UNTRACK(self);
|
_PyObject_GC_UNTRACK(self);
|
||||||
|
|
||||||
BaseException_clear(self);
|
BaseException_clear(self);
|
||||||
@ -3447,7 +3448,7 @@ PyTypeObject _PyExc_MemoryError = {
|
|||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"MemoryError",
|
"MemoryError",
|
||||||
sizeof(PyBaseExceptionObject),
|
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,
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
|
||||||
PyDoc_STR("Out of memory."), (traverseproc)BaseException_traverse,
|
PyDoc_STR("Out of memory."), (traverseproc)BaseException_traverse,
|
||||||
|
@ -143,14 +143,14 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
|||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
range_vectorcall(PyTypeObject *type, PyObject *const *args,
|
range_vectorcall(PyObject *rangetype, PyObject *const *args,
|
||||||
size_t nargsf, PyObject *kwnames)
|
size_t nargsf, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
|
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
|
||||||
if (!_PyArg_NoKwnames("range", kwnames)) {
|
if (!_PyArg_NoKwnames("range", kwnames)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return range_from_array(type, args, nargs);
|
return range_from_array((PyTypeObject *)rangetype, args, nargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(range_doc,
|
PyDoc_STRVAR(range_doc,
|
||||||
@ -803,7 +803,7 @@ PyTypeObject PyRange_Type = {
|
|||||||
0, /* tp_init */
|
0, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
range_new, /* tp_new */
|
range_new, /* tp_new */
|
||||||
.tp_vectorcall = (vectorcallfunc)range_vectorcall
|
.tp_vectorcall = range_vectorcall
|
||||||
};
|
};
|
||||||
|
|
||||||
/*********************** range Iterator **************************/
|
/*********************** range Iterator **************************/
|
||||||
|
@ -999,8 +999,9 @@ tupleiter_traverse(_PyTupleIterObject *it, visitproc visit, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
tupleiter_next(_PyTupleIterObject *it)
|
tupleiter_next(PyObject *obj)
|
||||||
{
|
{
|
||||||
|
_PyTupleIterObject *it = (_PyTupleIterObject *)obj;
|
||||||
PyTupleObject *seq;
|
PyTupleObject *seq;
|
||||||
PyObject *item;
|
PyObject *item;
|
||||||
|
|
||||||
@ -1101,7 +1102,7 @@ PyTypeObject PyTupleIter_Type = {
|
|||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
0, /* tp_weaklistoffset */
|
0, /* tp_weaklistoffset */
|
||||||
PyObject_SelfIter, /* tp_iter */
|
PyObject_SelfIter, /* tp_iter */
|
||||||
(iternextfunc)tupleiter_next, /* tp_iternext */
|
tupleiter_next, /* tp_iternext */
|
||||||
tupleiter_methods, /* tp_methods */
|
tupleiter_methods, /* tp_methods */
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user