diff options
author | Georg Brandl <georg@python.org> | 2008-03-25 08:29:14 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-03-25 08:29:14 (GMT) |
commit | d5b635f1969fdd609f0aff5669c9ec30e61be62e (patch) | |
tree | 1c854f8108e2b22d8c5ba4d529b6d99cd9f5f244 /Objects | |
parent | 80055f6295dd48274ae68d13806c7ee3c5b5882f (diff) | |
download | cpython-d5b635f1969fdd609f0aff5669c9ec30e61be62e.zip cpython-d5b635f1969fdd609f0aff5669c9ec30e61be62e.tar.gz cpython-d5b635f1969fdd609f0aff5669c9ec30e61be62e.tar.bz2 |
Make Py3k warnings consistent w.r.t. punctuation; also respect the
EOL 80 limit and supply more alternatives in warning messages.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bufferobject.c | 3 | ||||
-rw-r--r-- | Objects/cellobject.c | 5 | ||||
-rw-r--r-- | Objects/codeobject.c | 9 | ||||
-rw-r--r-- | Objects/dictobject.c | 9 | ||||
-rw-r--r-- | Objects/exceptions.c | 16 | ||||
-rw-r--r-- | Objects/listobject.c | 2 | ||||
-rw-r--r-- | Objects/methodobject.c | 17 | ||||
-rw-r--r-- | Objects/object.c | 11 | ||||
-rw-r--r-- | Objects/typeobject.c | 3 |
9 files changed, 42 insertions, 33 deletions
diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c index 0a818d6..fb7e1ef 100644 --- a/Objects/bufferobject.c +++ b/Objects/bufferobject.c @@ -231,7 +231,8 @@ buffer_new(PyTypeObject *type, PyObject *args, PyObject *kw) { if (Py_Py3kWarningFlag && PyErr_WarnEx(PyExc_DeprecationWarning, - "buffer will be removed in 3.x", 1) < 0) + "buffer() not supported in 3.x; " + "use memoryview()", 1) < 0) return NULL; PyObject *ob; diff --git a/Objects/cellobject.c b/Objects/cellobject.c index 2286aaf..b86739e 100644 --- a/Objects/cellobject.c +++ b/Objects/cellobject.c @@ -55,8 +55,9 @@ static int cell_compare(PyCellObject *a, PyCellObject *b) { /* Py3K warning for comparisons */ - if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning, - "cell comparisons not supported in 3.x.") < 0) { + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "cell comparisons not supported in 3.x") < 0) { return -2; } diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 57cd2e6..33b4610 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -338,9 +338,12 @@ code_richcompare(PyObject *self, PyObject *other, int op) !PyCode_Check(self) || !PyCode_Check(other)) { - /* Py3K warning if types are not equal and comparison isn't == or != */ - if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning, - "code inequality comparisons not supported in 3.x.") < 0) { + /* Py3K warning if types are not equal and comparison + isn't == or != */ + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "code inequality comparisons not supported " + "in 3.x") < 0) { return NULL; } diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 1ca2830..b897118 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1778,8 +1778,10 @@ dict_richcompare(PyObject *v, PyObject *w, int op) } else { /* Py3K warning if comparison isn't == or != */ - if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning, - "dict inequality comparisons not supported in 3.x.") < 0) { + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "dict inequality comparisons not supported " + "in 3.x") < 0) { return NULL; } res = Py_NotImplemented; @@ -1811,7 +1813,8 @@ dict_has_key(register PyDictObject *mp, PyObject *key) { if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning, - "dict.has_key() not supported in 3.x") < 0) + "dict.has_key() not supported in 3.x; " + "use the in operator") < 0) return NULL; return dict_contains(mp, key); } diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 7fecb35..ec17bc2 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -190,10 +190,10 @@ static PyObject * BaseException_getitem(PyBaseExceptionObject *self, Py_ssize_t index) { if (Py_Py3kWarningFlag) { - if (PyErr_Warn(PyExc_DeprecationWarning, - "In 3.x, __getitem__ is not supported for exception " - "classes, use args attribute") == -1) - return NULL; + if (PyErr_Warn(PyExc_DeprecationWarning, + "__getitem__ not supported for exception " + "classes in 3.x; use args attribute") == -1) + return NULL; } return PySequence_GetItem(self->args, index); } @@ -203,10 +203,10 @@ BaseException_getslice(PyBaseExceptionObject *self, Py_ssize_t start, Py_ssize_t stop) { if (Py_Py3kWarningFlag) { - if (PyErr_Warn(PyExc_DeprecationWarning, - "In 3.x, __getslice__ is not supported for exception " - "classes, use args attribute") == -1) - return NULL; + if (PyErr_Warn(PyExc_DeprecationWarning, + "__getslice__ not supported for exception " + "classes in 3.x; use args attribute") == -1) + return NULL; } return PySequence_GetSlice(self->args, start, stop); } diff --git a/Objects/listobject.c b/Objects/listobject.c index d4faf0a..81617e4 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2040,7 +2040,7 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds) if (compare != NULL && Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning, - "In 3.x, the cmp argument is no longer supported.") < 0) + "the cmp argument is not supported in 3.x") < 0) return NULL; if (keyfunc == Py_None) keyfunc = NULL; diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 16175f9..e641df1 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -235,9 +235,10 @@ meth_richcompare(PyObject *self, PyObject *other, int op) !PyCFunction_Check(other)) { /* Py3K warning if types are not equal and comparison isn't == or != */ - if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning, - "builtin_function_or_method " - "inequality comparisons not supported in 3.x.") < 0) { + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "builtin_function_or_method inequality " + "comparisons not supported in 3.x") < 0) { return NULL; } @@ -353,12 +354,10 @@ Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, const char *name) { if (name[0] == '_' && name[1] == '_') { if (strcmp(name, "__methods__") == 0) { - if (Py_Py3kWarningFlag) { - if (PyErr_Warn(PyExc_DeprecationWarning, - "__methods__ not supported " - "in 3.x") < 0) - return NULL; - } + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "__methods__ not supported in 3.x") < 0) + return NULL; return listmethodchain(chain); } if (strcmp(name, "__doc__") == 0) { diff --git a/Objects/object.c b/Objects/object.c index 4a66f4f..e3377f3 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -867,9 +867,10 @@ try_3way_to_rich_compare(PyObject *v, PyObject *w, int op) /* Py3K warning if types are not equal and comparison isn't == or != */ if (Py_Py3kWarningFlag && - v->ob_type != w->ob_type && op != Py_EQ && op != Py_NE && - PyErr_Warn(PyExc_DeprecationWarning, - "comparing unequal types not supported in 3.x.") < 0) { + v->ob_type != w->ob_type && op != Py_EQ && op != Py_NE && + PyErr_Warn(PyExc_DeprecationWarning, + "comparing unequal types not supported " + "in 3.x") < 0) { return NULL; } @@ -1691,8 +1692,8 @@ merge_list_attr(PyObject* dict, PyObject* obj, const char *attrname) (strcmp(attrname, "__members__") == 0 || strcmp(attrname, "__methods__") == 0)) { if (PyErr_Warn(PyExc_DeprecationWarning, - "__members__ and __methods__ not supported " - "in 3.x") < 0) { + "__members__ and __methods__ not " + "supported in 3.x") < 0) { Py_XDECREF(list); return -1; } diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 82ced39..214e601 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -609,7 +609,8 @@ type_richcompare(PyObject *v, PyObject *w, int op) /* Py3K warning if comparison isn't == or != */ if (Py_Py3kWarningFlag && op != Py_EQ && op != Py_NE && PyErr_Warn(PyExc_DeprecationWarning, - "type inequality comparisons not supported in 3.x.") < 0) { + "type inequality comparisons not supported " + "in 3.x") < 0) { return NULL; } |