Use PyErr_WarnPy3k throughout

This commit is contained in:
Benjamin Peterson 2008-04-27 03:01:45 +00:00
parent a692c4df63
commit 9f4f48114f
14 changed files with 47 additions and 88 deletions

View file

@ -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);
}