]> granicus.if.org Git - python/commitdiff
Merged revisions 81740 via svnmerge from
authorMark Dickinson <dickinsm@gmail.com>
Sat, 5 Jun 2010 12:15:35 +0000 (12:15 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Sat, 5 Jun 2010 12:15:35 +0000 (12:15 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81740 | mark.dickinson | 2010-06-05 13:14:43 +0100 (Sat, 05 Jun 2010) | 5 lines

  Issue #8627: Fix "XXX undetected error" from unchecked PyErr_WarnPy3k return.
  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 cb457b24776c5408075a41a03980548b63af7933..28523fa870b5c60a232fdd61b4496c02eb463aec 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 #3798: Write sys.exit() message to sys.stderr to use stderr encoding
   and error handler, instead of writing to the C stderr file in utf-8
index af2dc0b071ea4cbc2ede452f9cc876fb8980f0a6..f496804e4c32e7328abcbbabd399422be11624f0 100644 (file)
@@ -3853,10 +3853,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();
                     }
                 }
             }