bpo-33029: Fix signatures of getter and setter functions. (GH-10746)
Fix also return type for few other functions (clear, releasebuffer).
(cherry picked from commit d4f9cf5545d6d8844e0726552ef2e366f5cc3abd)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 241685d..413a590 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -242,14 +242,14 @@
};
static PyObject *
-func_get_code(PyFunctionObject *op)
+func_get_code(PyFunctionObject *op, void *Py_UNUSED(ignored))
{
Py_INCREF(op->func_code);
return op->func_code;
}
static int
-func_set_code(PyFunctionObject *op, PyObject *value)
+func_set_code(PyFunctionObject *op, PyObject *value, void *Py_UNUSED(ignored))
{
Py_ssize_t nfree, nclosure;
@@ -277,14 +277,14 @@
}
static PyObject *
-func_get_name(PyFunctionObject *op)
+func_get_name(PyFunctionObject *op, void *Py_UNUSED(ignored))
{
Py_INCREF(op->func_name);
return op->func_name;
}
static int
-func_set_name(PyFunctionObject *op, PyObject *value)
+func_set_name(PyFunctionObject *op, PyObject *value, void *Py_UNUSED(ignored))
{
/* Not legal to del f.func_name or to set it to anything
* other than a string object. */
@@ -299,14 +299,14 @@
}
static PyObject *
-func_get_qualname(PyFunctionObject *op)
+func_get_qualname(PyFunctionObject *op, void *Py_UNUSED(ignored))
{
Py_INCREF(op->func_qualname);
return op->func_qualname;
}
static int
-func_set_qualname(PyFunctionObject *op, PyObject *value)
+func_set_qualname(PyFunctionObject *op, PyObject *value, void *Py_UNUSED(ignored))
{
/* Not legal to del f.__qualname__ or to set it to anything
* other than a string object. */
@@ -321,7 +321,7 @@
}
static PyObject *
-func_get_defaults(PyFunctionObject *op)
+func_get_defaults(PyFunctionObject *op, void *Py_UNUSED(ignored))
{
if (op->func_defaults == NULL) {
Py_RETURN_NONE;
@@ -331,7 +331,7 @@
}
static int
-func_set_defaults(PyFunctionObject *op, PyObject *value)
+func_set_defaults(PyFunctionObject *op, PyObject *value, void *Py_UNUSED(ignored))
{
/* Legal to del f.func_defaults.
* Can only set func_defaults to NULL or a tuple. */
@@ -348,7 +348,7 @@
}
static PyObject *
-func_get_kwdefaults(PyFunctionObject *op)
+func_get_kwdefaults(PyFunctionObject *op, void *Py_UNUSED(ignored))
{
if (op->func_kwdefaults == NULL) {
Py_RETURN_NONE;
@@ -358,7 +358,7 @@
}
static int
-func_set_kwdefaults(PyFunctionObject *op, PyObject *value)
+func_set_kwdefaults(PyFunctionObject *op, PyObject *value, void *Py_UNUSED(ignored))
{
if (value == Py_None)
value = NULL;
@@ -375,7 +375,7 @@
}
static PyObject *
-func_get_annotations(PyFunctionObject *op)
+func_get_annotations(PyFunctionObject *op, void *Py_UNUSED(ignored))
{
if (op->func_annotations == NULL) {
op->func_annotations = PyDict_New();
@@ -387,7 +387,7 @@
}
static int
-func_set_annotations(PyFunctionObject *op, PyObject *value)
+func_set_annotations(PyFunctionObject *op, PyObject *value, void *Py_UNUSED(ignored))
{
if (value == Py_None)
value = NULL;