summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-04-27 03:01:45 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-04-27 03:01:45 (GMT)
commit9f4f48114fbf2df3803a44a30cd14e11679403fe (patch)
tree701fc350aa3a6ebf282fdb92e891c793f65db0fb /Objects/exceptions.c
parenta692c4df63a41c42f2ce10a4521136d1440a712d (diff)
downloadcpython-9f4f48114fbf2df3803a44a30cd14e11679403fe.zip
cpython-9f4f48114fbf2df3803a44a30cd14e11679403fe.tar.gz
cpython-9f4f48114fbf2df3803a44a30cd14e11679403fe.tar.bz2
Use PyErr_WarnPy3k throughout
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c18
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);
}