]> granicus.if.org Git - python/commitdiff
Issue #8627: Fix "XXX undetected error" from unchecked PyErr_WarnPy3k return.
authorMark Dickinson <dickinsm@gmail.com>
Sat, 5 Jun 2010 12:14:43 +0000 (12:14 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Sat, 5 Jun 2010 12:14:43 +0000 (12:14 +0000)
This is just a quick fix:  if the warning is turned into an exception, the
exception simply gets ignored.

Misc/NEWS
Objects/typeobject.c

index 3378c5d44df8f05183c73451022c25c64d949b22..8608d03b17b7251e4f82ec4a5ac6e8b226e7dc7a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,7 +13,10 @@ Core and Builtins
 -----------------
 
 - Issue #8627: Remove bogus "Overriding __cmp__ blocks inheritance of
-  __hash__ in 3.x" warning.
+  __hash__ in 3.x" warning.  Also fix "XXX undetected error" that
+  arises from the "Overriding __eq__ blocks inheritance ..." warning
+  when turned into an exception: in this case the exception simply
+  gets ignored.
 
 - Issue #8748: Fix two issues with comparisons between complex and integer
   objects.  (1) The comparison could incorrectly return True in some cases
index 5767b87dfe13f88e97890b01b518afd39083011a..b28ab4d6daadbf84de04933e0b4e840acf302ef9 100644 (file)
@@ -3869,10 +3869,16 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
                                 (base->tp_hash != PyObject_HashNotImplemented) &&
                                 !OVERRIDES_HASH(type)) {
                     if (OVERRIDES_EQ(type)) {
-                        PyErr_WarnPy3k("Overriding "
-                          "__eq__ blocks inheritance "
-                          "of __hash__ in 3.x",
-                          1);
+                        if (PyErr_WarnPy3k("Overriding "
+                                           "__eq__ blocks inheritance "
+                                           "of __hash__ in 3.x",
+                                           1) < 0)
+                            /* XXX This isn't right.  If the warning is turned
+                               into an exception, we should be communicating
+                               the error back to the caller, but figuring out
+                               how to clean-up in that case is tricky.  See
+                               issue 8627 for more. */
+                            PyErr_Clear();
                     }
                 }
             }