]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111178: fix UBSan failures for `PyStdPrinter_Object` (#131607)
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Mon, 24 Mar 2025 09:57:14 +0000 (10:57 +0100)
committerGitHub <noreply@github.com>
Mon, 24 Mar 2025 09:57:14 +0000 (10:57 +0100)
Objects/fileobject.c

index 4898e046ff79a6874eff35cf8df70442852959ac..e624405bd5f62f48dc346a99fdf9dc2f4c3b9f69 100644 (file)
@@ -404,27 +404,27 @@ static PyMethodDef stdprinter_methods[] = {
 };
 
 static PyObject *
-get_closed(PyStdPrinter_Object *self, void *closure)
+get_closed(PyObject *self, void *Py_UNUSED(closure))
 {
     Py_RETURN_FALSE;
 }
 
 static PyObject *
-get_mode(PyStdPrinter_Object *self, void *closure)
+get_mode(PyObject *self, void *Py_UNUSED(closure))
 {
     return PyUnicode_FromString("w");
 }
 
 static PyObject *
-get_encoding(PyStdPrinter_Object *self, void *closure)
+get_encoding(PyObject *self, void *Py_UNUSED(closure))
 {
     Py_RETURN_NONE;
 }
 
 static PyGetSetDef stdprinter_getsetlist[] = {
-    {"closed", (getter)get_closed, NULL, "True if the file is closed"},
-    {"encoding", (getter)get_encoding, NULL, "Encoding of the file"},
-    {"mode", (getter)get_mode, NULL, "String giving the file mode"},
+    {"closed", get_closed, NULL, "True if the file is closed"},
+    {"encoding", get_encoding, NULL, "Encoding of the file"},
+    {"mode", get_mode, NULL, "String giving the file mode"},
     {0},
 };