diff options
author | Steven Bethard <steven.bethard@gmail.com> | 2008-03-18 17:26:10 +0000 |
---|---|---|
committer | Steven Bethard <steven.bethard@gmail.com> | 2008-03-18 17:26:10 +0000 |
commit | 7eab6bfea2daf42efb36b761f09feafc9afbab66 (patch) | |
tree | 61e70b9f903f9b368d7a5eae501b8a7fdd0dce7c /Objects/dictobject.c | |
parent | ffb1b996911cedd5c61d16dd6b130883fabc9434 (diff) | |
download | cpython-7eab6bfea2daf42efb36b761f09feafc9afbab66.tar.gz |
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 124678544a..1ca28303c7 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1776,8 +1776,14 @@ dict_richcompare(PyObject *v, PyObject *w, int op) return NULL; res = (cmp == (op == Py_EQ)) ? Py_True : Py_False; } - else + else { + /* Py3K warning if comparison isn't == or != */ + if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning, + "dict inequality comparisons not supported in 3.x.") < 0) { + return NULL; + } res = Py_NotImplemented; + } Py_INCREF(res); return res; } |