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