mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
A little reformating of Py3k warnings
This commit is contained in:
parent
fe4948bcef
commit
f19a7b90bd
11 changed files with 33 additions and 35 deletions
|
@ -56,7 +56,7 @@ cell_compare(PyCellObject *a, PyCellObject *b)
|
|||
{
|
||||
/* Py3K warning for comparisons */
|
||||
if (PyErr_WarnPy3k("cell comparisons not supported in 3.x",
|
||||
1) < 0) {
|
||||
1) < 0) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
|
|
@ -339,9 +339,9 @@ code_richcompare(PyObject *self, PyObject *other, int op)
|
|||
!PyCode_Check(other)) {
|
||||
|
||||
/* Py3K warning if types are not equal and comparison
|
||||
isn't == or != */
|
||||
isn't == or != */
|
||||
if (PyErr_WarnPy3k("code inequality comparisons not supported "
|
||||
"in 3.x", 1) < 0) {
|
||||
"in 3.x", 1) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1779,7 +1779,7 @@ dict_richcompare(PyObject *v, PyObject *w, int op)
|
|||
else {
|
||||
/* Py3K warning if comparison isn't == or != */
|
||||
if (PyErr_WarnPy3k("dict inequality comparisons not supported "
|
||||
"in 3.x", 1) < 0) {
|
||||
"in 3.x", 1) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
res = Py_NotImplemented;
|
||||
|
@ -1810,7 +1810,7 @@ static PyObject *
|
|||
dict_has_key(register PyDictObject *mp, PyObject *key)
|
||||
{
|
||||
if (PyErr_WarnPy3k("dict.has_key() not supported in 3.x; "
|
||||
"use the in operator", 1) < 0)
|
||||
"use the in operator", 1) < 0)
|
||||
return NULL;
|
||||
return dict_contains(mp, key);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -2038,7 +2038,7 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
|
|||
if (compare == Py_None)
|
||||
compare = NULL;
|
||||
if (compare != NULL &&
|
||||
PyErr_WarnPy3k("the cmp argument is not supported in 3.x", 1) < 0)
|
||||
PyErr_WarnPy3k("the cmp argument is not supported in 3.x", 1) < 0)
|
||||
return NULL;
|
||||
if (keyfunc == Py_None)
|
||||
keyfunc = NULL;
|
||||
|
|
|
@ -236,7 +236,7 @@ meth_richcompare(PyObject *self, PyObject *other, int op)
|
|||
{
|
||||
/* Py3K warning if types are not equal and comparison isn't == or != */
|
||||
if (PyErr_WarnPy3k("builtin_function_or_method inequality "
|
||||
"comparisons not supported in 3.x", 1) < 0) {
|
||||
"comparisons not supported in 3.x", 1) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue