summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorSteven Bethard <steven.bethard@gmail.com>2008-03-18 17:26:10 (GMT)
committerSteven Bethard <steven.bethard@gmail.com>2008-03-18 17:26:10 (GMT)
commitae42f33cdfb68be2fc71be0fb67ec025f90160e8 (patch)
tree07985bc750d9266f2e725b6ba46b0f71c17c8d08 /Objects/dictobject.c
parenta8b09fd4c33572a204a80c81e5755cc6d164805d (diff)
downloadcpython-ae42f33cdfb68be2fc71be0fb67ec025f90160e8.zip
cpython-ae42f33cdfb68be2fc71be0fb67ec025f90160e8.tar.gz
cpython-ae42f33cdfb68be2fc71be0fb67ec025f90160e8.tar.bz2
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.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 1246785..1ca2830 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;
}