From 660370bbec657e48e375d8e6aa297c02ce750c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Thu, 20 Mar 2025 15:29:56 +0100 Subject: [PATCH] fix UBSan failures for `PyStdPrinter_Object` --- Objects/fileobject.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 4898e046ff79a6..e624405bd5f62f 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -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}, };