Message105041
Lines 3884 and 3890 of Objects/typeobject.c (trunk, r80782), which check for a subclass overriding __eq__ (or __cmp__) but not __hash__, call PyErr_WarnPy3k but don't check the return value. [This was reported when compiling Python with clang.] This can lead to an "XXX undetected error", if the warning actually raised an exception:
newton:trunk dickinsm$ ./python.exe -3
Python 2.7b1+ (trunk:80783, May 5 2010, 15:25:42)
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
[35022 refs]
>>> warnings.filterwarnings("error")
[35046 refs]
>>> class A(object):
... def __eq__(self, other):
... return False
...
XXX undetected error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x
[35139 refs]
Nick, I think this came from a checkin of yours: r65642, related to issue 2235. Any suggestions about how to fix it? It's a bit tricky, since the function the check occurs in (inherit_slots) has return type 'void'. Is it okay if I change inherit_slots to return an int here? If so, I'll produce a patch.
Also, can we remove the check related to __hash__ and __cmp__? With __cmp__ gone in 3.1, and 3.0 considered defunct, I don't think it's relevant any more. |
|
Date |
User |
Action |
Args |
2010-05-05 14:30:57 | mark.dickinson | set | recipients:
+ mark.dickinson, ncoghlan |
2010-05-05 14:30:56 | mark.dickinson | set | messageid: <1273069856.93.0.435136167669.issue8627@psf.upfronthosting.co.za> |
2010-05-05 14:30:55 | mark.dickinson | link | issue8627 messages |
2010-05-05 14:30:54 | mark.dickinson | create | |
|