A little reformating of Py3k warnings

This commit is contained in:
Benjamin Peterson 2008-04-27 18:40:21 +00:00
parent fe4948bcef
commit f19a7b90bd
11 changed files with 33 additions and 35 deletions

View File

@ -279,9 +279,8 @@ BaseException_get_message(PyBaseExceptionObject *self)
int ret;
ret = PyErr_WarnEx(PyExc_DeprecationWarning,
"BaseException.message has been deprecated as "
"of Python 2.6",
1);
if (ret == -1)
"of Python 2.6", 1);
if (ret < 0)
return NULL;
Py_INCREF(self->message);
@ -294,9 +293,8 @@ BaseException_set_message(PyBaseExceptionObject *self, PyObject *val)
int ret;
ret = PyErr_WarnEx(PyExc_DeprecationWarning,
"BaseException.message has been deprecated as "
"of Python 2.6",
1);
if (ret == -1)
"of Python 2.6", 1);
if (ret < 0)
return -1;
Py_INCREF(val);
Py_DECREF(self->message);

View File

@ -627,8 +627,9 @@ file_seek(PyFileObject *f, PyObject *args)
return NULL;
/* Deprecated in 2.6 */
PyErr_Clear();
if (PyErr_Warn(PyExc_DeprecationWarning,
"integer argument expected, got float"))
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"integer argument expected, got float",
1) < 0)
return NULL;
off_index = offobj;
Py_INCREF(offobj);

View File

@ -352,9 +352,8 @@ Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, const char *name)
{
if (name[0] == '_' && name[1] == '_') {
if (strcmp(name, "__methods__") == 0) {
if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning,
"__methods__ not supported in 3.x") < 0)
if (PyErr_WarnPy3k("__methods__ not supported in 3.x",
1) < 0)
return NULL;
return listmethodchain(chain);
}

View File

@ -3166,7 +3166,7 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
if (Py_Py3kWarningFlag && PyClass_Check(type)) {
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"exceptions must derive from BaseException "
"in 3.x", 1) == -1)
"in 3.x", 1) < 0)
goto raise_error;
}
@ -4092,7 +4092,7 @@ cmp_outcome(int op, register PyObject *v, register PyObject *w)
PyExc_DeprecationWarning,
"catching of string "
"exceptions is deprecated", 1);
if (ret_val == -1)
if (ret_val < 0)
return NULL;
}
else if (Py_Py3kWarningFlag &&
@ -4103,7 +4103,7 @@ cmp_outcome(int op, register PyObject *v, register PyObject *w)
ret_val = PyErr_WarnEx(
PyExc_DeprecationWarning,
CANNOT_CATCH_MSG, 1);
if (ret_val == -1)
if (ret_val < 0)
return NULL;
}
}
@ -4115,7 +4115,7 @@ cmp_outcome(int op, register PyObject *v, register PyObject *w)
PyExc_DeprecationWarning,
"catching of string "
"exceptions is deprecated", 1);
if (ret_val == -1)
if (ret_val < 0)
return NULL;
}
else if (Py_Py3kWarningFlag &&
@ -4126,7 +4126,7 @@ cmp_outcome(int op, register PyObject *v, register PyObject *w)
ret_val = PyErr_WarnEx(
PyExc_DeprecationWarning,
CANNOT_CATCH_MSG, 1);
if (ret_val == -1)
if (ret_val < 0)
return NULL;
}
}