]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98724: Fix warnings on Py_SETREF() usage (#99781)
authorVictor Stinner <vstinner@python.org>
Fri, 25 Nov 2022 23:30:37 +0000 (00:30 +0100)
committerGitHub <noreply@github.com>
Fri, 25 Nov 2022 23:30:37 +0000 (00:30 +0100)
Cast argument to the expected type.

Modules/_curses_panel.c
Objects/longobject.c
Objects/typeobject.c

index cd408d6aa3599468d06b5bc47a8d80c02731e771..2144345de01ba3c8d1c431c77227ab9ffdd1858f 100644 (file)
@@ -424,7 +424,7 @@ _curses_panel_panel_replace_impl(PyCursesPanelObject *self,
         PyErr_SetString(state->PyCursesError, "replace_panel() returned ERR");
         return NULL;
     }
-    Py_SETREF(po->wo, Py_NewRef(win));
+    Py_SETREF(po->wo, (PyCursesWindowObject*)Py_NewRef(win));
     Py_RETURN_NONE;
 }
 
index f4bd981e4b9870fa4a9222ee9b87fcf34c3f6764..c84b4d3f316d5ddc8b9f2abf305572f7d844ac8d 100644 (file)
@@ -4775,7 +4775,7 @@ long_pow(PyObject *v, PyObject *w, PyObject *x)
          * because we're primarily trying to cut overhead for small powers.
          */
         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) {
             if (bit > bi) { /* found the first bit */
                 assert((bi & bit) == 0);
index ad8a936fa7ce20dc8e28a79efac039a00cbfe0d4..b993aa405f6b6aaf739f0513d764b9ae372d612d 100644 (file)
@@ -9593,7 +9593,7 @@ super_init_impl(PyObject *self, PyTypeObject *type, PyObject *obj) {
             return -1;
         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_type, obj_type);
     return 0;