gh-111178: Fix function signatures for test_os (#131227)

This commit is contained in:
Victor Stinner 2025-03-14 14:53:06 +01:00 committed by GitHub
parent ca7fd814e4
commit db62557e3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 6 deletions

View file

@ -272,8 +272,10 @@ typedef struct {
} HandoffData; } HandoffData;
static void static void
maybe_handoff_item(HandoffData *data, PyObject **item, int has_more_waiters) maybe_handoff_item(void *arg, void *park_arg, int has_more_waiters)
{ {
HandoffData *data = (HandoffData*)arg;
PyObject **item = (PyObject**)park_arg;
if (item == NULL) { if (item == NULL) {
// No threads were waiting // No threads were waiting
data->handed_off = false; data->handed_off = false;
@ -313,7 +315,7 @@ _queue_SimpleQueue_put_impl(simplequeueobject *self, PyObject *item,
if (self->has_threads_waiting) { if (self->has_threads_waiting) {
// Try to hand the item off directly if there are threads waiting // Try to hand the item off directly if there are threads waiting
_PyParkingLot_Unpark(&self->has_threads_waiting, _PyParkingLot_Unpark(&self->has_threads_waiting,
(_Py_unpark_fn_t *)maybe_handoff_item, &data); maybe_handoff_item, &data);
} }
if (!data.handed_off) { if (!data.handed_off) {
if (RingBuf_Put(&self->buf, item) < 0) { if (RingBuf_Put(&self->buf, item) < 0) {

View file

@ -1731,8 +1731,9 @@ idna_cleanup(struct maybe_idna *data)
} }
static int static int
idna_converter(PyObject *obj, struct maybe_idna *data) idna_converter(PyObject *obj, void *arg)
{ {
struct maybe_idna *data = (struct maybe_idna*)arg;
size_t len; size_t len;
PyObject *obj2; PyObject *obj2;
if (obj == NULL) { if (obj == NULL) {

View file

@ -334,8 +334,9 @@ error:
static PyObject * static PyObject *
structseq_reduce(PyStructSequence* self, PyObject *Py_UNUSED(ignored)) structseq_reduce(PyObject *op, PyObject *Py_UNUSED(ignored))
{ {
PyStructSequence *self = (PyStructSequence*)op;
PyObject* tup = NULL; PyObject* tup = NULL;
PyObject* dict = NULL; PyObject* dict = NULL;
PyObject* result; PyObject* result;
@ -379,8 +380,9 @@ error:
static PyObject * static PyObject *
structseq_replace(PyStructSequence *self, PyObject *args, PyObject *kwargs) structseq_replace(PyObject *op, PyObject *args, PyObject *kwargs)
{ {
PyStructSequence *self = (PyStructSequence*)op;
PyStructSequence *result = NULL; PyStructSequence *result = NULL;
Py_ssize_t n_fields, n_unnamed_fields, i; Py_ssize_t n_fields, n_unnamed_fields, i;
@ -449,7 +451,7 @@ error:
} }
static PyMethodDef structseq_methods[] = { static PyMethodDef structseq_methods[] = {
{"__reduce__", (PyCFunction)structseq_reduce, METH_NOARGS, NULL}, {"__reduce__", structseq_reduce, METH_NOARGS, NULL},
{"__replace__", _PyCFunction_CAST(structseq_replace), METH_VARARGS | METH_KEYWORDS, {"__replace__", _PyCFunction_CAST(structseq_replace), METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("__replace__($self, /, **changes)\n--\n\n" PyDoc_STR("__replace__($self, /, **changes)\n--\n\n"
"Return a copy of the structure with new values for the specified fields.")}, "Return a copy of the structure with new values for the specified fields.")},