summaryrefslogtreecommitdiff
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-11-27 19:34:35 +0200
committerGitHub <noreply@github.com>2018-11-27 19:34:35 +0200
commitd4f9cf5545d6d8844e0726552ef2e366f5cc3abd (patch)
tree7aefae9861ee6b83652f6a352397b9dc145cc0d3 /Objects/exceptions.c
parent1005c84535191a72ebb7587d8c5636a065b7ed79 (diff)
downloadcpython-git-d4f9cf5545d6d8844e0726552ef2e366f5cc3abd.tar.gz
bpo-33029: Fix signatures of getter and setter functions. (GH-10746)
Fix also return type for few other functions (clear, releasebuffer).
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index cecbf977a3..05578d4a6a 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -182,7 +182,7 @@ static PyMethodDef BaseException_methods[] = {
};
static PyObject *
-BaseException_get_args(PyBaseExceptionObject *self)
+BaseException_get_args(PyBaseExceptionObject *self, void *Py_UNUSED(ignored))
{
if (self->args == NULL) {
Py_RETURN_NONE;
@@ -192,7 +192,7 @@ BaseException_get_args(PyBaseExceptionObject *self)
}
static int
-BaseException_set_args(PyBaseExceptionObject *self, PyObject *val)
+BaseException_set_args(PyBaseExceptionObject *self, PyObject *val, void *Py_UNUSED(ignored))
{
PyObject *seq;
if (val == NULL) {
@@ -207,7 +207,7 @@ BaseException_set_args(PyBaseExceptionObject *self, PyObject *val)
}
static PyObject *
-BaseException_get_tb(PyBaseExceptionObject *self)
+BaseException_get_tb(PyBaseExceptionObject *self, void *Py_UNUSED(ignored))
{
if (self->traceback == NULL) {
Py_RETURN_NONE;
@@ -217,7 +217,7 @@ BaseException_get_tb(PyBaseExceptionObject *self)
}
static int
-BaseException_set_tb(PyBaseExceptionObject *self, PyObject *tb)
+BaseException_set_tb(PyBaseExceptionObject *self, PyObject *tb, void *Py_UNUSED(ignored))
{
if (tb == NULL) {
PyErr_SetString(PyExc_TypeError, "__traceback__ may not be deleted");
@@ -235,7 +235,8 @@ BaseException_set_tb(PyBaseExceptionObject *self, PyObject *tb)
}
static PyObject *
-BaseException_get_context(PyObject *self) {
+BaseException_get_context(PyObject *self, void *Py_UNUSED(ignored))
+{
PyObject *res = PyException_GetContext(self);
if (res)
return res; /* new reference already returned above */
@@ -243,7 +244,8 @@ BaseException_get_context(PyObject *self) {
}
static int
-BaseException_set_context(PyObject *self, PyObject *arg) {
+BaseException_set_context(PyObject *self, PyObject *arg, void *Py_UNUSED(ignored))
+{
if (arg == NULL) {
PyErr_SetString(PyExc_TypeError, "__context__ may not be deleted");
return -1;
@@ -262,7 +264,8 @@ BaseException_set_context(PyObject *self, PyObject *arg) {
}
static PyObject *
-BaseException_get_cause(PyObject *self) {
+BaseException_get_cause(PyObject *self, void *Py_UNUSED(ignored))
+{
PyObject *res = PyException_GetCause(self);
if (res)
return res; /* new reference already returned above */
@@ -270,7 +273,8 @@ BaseException_get_cause(PyObject *self) {
}
static int
-BaseException_set_cause(PyObject *self, PyObject *arg) {
+BaseException_set_cause(PyObject *self, PyObject *arg, void *Py_UNUSED(ignored))
+{
if (arg == NULL) {
PyErr_SetString(PyExc_TypeError, "__cause__ may not be deleted");
return -1;
@@ -293,10 +297,10 @@ static PyGetSetDef BaseException_getset[] = {
{"__dict__", PyObject_GenericGetDict, PyObject_GenericSetDict},
{"args", (getter)BaseException_get_args, (setter)BaseException_set_args},
{"__traceback__", (getter)BaseException_get_tb, (setter)BaseException_set_tb},
- {"__context__", (getter)BaseException_get_context,
- (setter)BaseException_set_context, PyDoc_STR("exception context")},
- {"__cause__", (getter)BaseException_get_cause,
- (setter)BaseException_set_cause, PyDoc_STR("exception cause")},
+ {"__context__", BaseException_get_context,
+ BaseException_set_context, PyDoc_STR("exception context")},
+ {"__cause__", BaseException_get_cause,
+ BaseException_set_cause, PyDoc_STR("exception cause")},
{NULL},
};
@@ -311,7 +315,7 @@ PyException_GetTraceback(PyObject *self) {
int
PyException_SetTraceback(PyObject *self, PyObject *tb) {
- return BaseException_set_tb((PyBaseExceptionObject *)self, tb);
+ return BaseException_set_tb((PyBaseExceptionObject *)self, tb, NULL);
}
PyObject *