gh-98724: Fix warnings on Py_SETREF() usage (#99781)

Cast argument to the expected type.
This commit is contained in:
Victor Stinner 2022-11-26 00:30:37 +01:00 committed by GitHub
parent ae234fbc5c
commit 5556d3e02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -424,7 +424,7 @@ _curses_panel_panel_replace_impl(PyCursesPanelObject *self,
PyErr_SetString(state->PyCursesError, "replace_panel() returned ERR"); PyErr_SetString(state->PyCursesError, "replace_panel() returned ERR");
return NULL; return NULL;
} }
Py_SETREF(po->wo, Py_NewRef(win)); Py_SETREF(po->wo, (PyCursesWindowObject*)Py_NewRef(win));
Py_RETURN_NONE; Py_RETURN_NONE;
} }

View File

@ -4775,7 +4775,7 @@ long_pow(PyObject *v, PyObject *w, PyObject *x)
* because we're primarily trying to cut overhead for small powers. * because we're primarily trying to cut overhead for small powers.
*/ */
assert(bi); /* else there is no significant bit */ assert(bi); /* else there is no significant bit */
Py_SETREF(z, Py_NewRef(a)); Py_SETREF(z, (PyLongObject*)Py_NewRef(a));
for (bit = 2; ; bit <<= 1) { for (bit = 2; ; bit <<= 1) {
if (bit > bi) { /* found the first bit */ if (bit > bi) { /* found the first bit */
assert((bi & bit) == 0); assert((bi & bit) == 0);

View File

@ -9593,7 +9593,7 @@ super_init_impl(PyObject *self, PyTypeObject *type, PyObject *obj) {
return -1; return -1;
Py_INCREF(obj); Py_INCREF(obj);
} }
Py_XSETREF(su->type, Py_NewRef(type)); Py_XSETREF(su->type, (PyTypeObject*)Py_NewRef(type));
Py_XSETREF(su->obj, obj); Py_XSETREF(su->obj, obj);
Py_XSETREF(su->obj_type, obj_type); Py_XSETREF(su->obj_type, obj_type);
return 0; return 0;