mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Use PyErr_WarnPy3k throughout
This commit is contained in:
parent
a692c4df63
commit
9f4f48114f
14 changed files with 47 additions and 88 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue