diff options
Diffstat (limited to 'Objects/exceptions.c')
| -rw-r--r-- | Objects/exceptions.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 2451a91..4a9eba1 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -189,12 +189,9 @@ static PyMethodDef BaseException_methods[] = { static PyObject * BaseException_getitem(PyBaseExceptionObject *self, Py_ssize_t index) { - if (Py_Py3kWarningFlag) { - if (PyErr_Warn(PyExc_DeprecationWarning, - "__getitem__ not supported for exception " - "classes in 3.x; use args attribute") == -1) - return NULL; - } + if (PyErr_WarnPy3k("__getitem__ not supported for exception " + "classes in 3.x; use args attribute", 1) < 0) + return NULL; return PySequence_GetItem(self->args, index); } @@ -202,12 +199,9 @@ static PyObject * BaseException_getslice(PyBaseExceptionObject *self, Py_ssize_t start, Py_ssize_t stop) { - if (Py_Py3kWarningFlag) { - if (PyErr_Warn(PyExc_DeprecationWarning, - "__getslice__ not supported for exception " - "classes in 3.x; use args attribute") == -1) - return NULL; - } + if (PyErr_WarnPy3k("__getslice__ not supported for exception " + "classes in 3.x; use args attribute", 1) < 0) + return NULL; return PySequence_GetSlice(self->args, start, stop); } |
