]> granicus.if.org Git - python/commitdiff
avoid casting with this nice macro
authorBenjamin Peterson <benjamin@python.org>
Sun, 6 Mar 2011 15:06:34 +0000 (09:06 -0600)
committerBenjamin Peterson <benjamin@python.org>
Sun, 6 Mar 2011 15:06:34 +0000 (09:06 -0600)
Objects/unicodeobject.c

index 1d0e97b8ce09515eb89496077df3af9573c707dd..db9f7060ed71d5c0350ba00c1d92afd6b7c4e206 100644 (file)
@@ -7358,8 +7358,7 @@ PyUnicode_RichCompare(PyObject *left, PyObject *right, int op)
 
     if (PyUnicode_Check(left) && PyUnicode_Check(right)) {
         PyObject *v;
-        if (((PyUnicodeObject *) left)->length !=
-            ((PyUnicodeObject *) right)->length) {
+        if (PyUnicode_GET_SIZE(left) != PyUnicode_GET_SIZE(right)) {
             if (op == Py_EQ) {
                 Py_INCREF(Py_False);
                 return Py_False;