-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/04/2011 10:18 AM, Gediminas Paulauskas wrote:
> Log message for revision 122462: Fix a regression introduced in
> 3.6.4, that made one zope.app.interface test fail
> 
> 
> Changed: U   zope.interface/trunk/CHANGES.txt U
> zope.interface/trunk/src/zope/interface/interface.py
> 
> -=- Modified: zope.interface/trunk/CHANGES.txt 
> =================================================================== 
> --- zope.interface/trunk/CHANGES.txt  2011-08-04 13:44:20 UTC (rev
> 122461) +++ zope.interface/trunk/CHANGES.txt  2011-08-04 14:18:37 UTC
> (rev 122462) @@ -11,10 +11,12 @@
> 
> - Fix testing deprecation warnings issued when tested under Py3K.
> 
> +- Fix ``InterfaceClass.__hash__`` to match comparison function. + 
> 3.6.4 (2011-07-04) ------------------
> 
> -- LP 804951:  InterfaceClass instances were unhashable under Python
> 3.x. +- LP #804951:  InterfaceClass instances were unhashable under
> Python 3.x.
> 
> 3.6.3 (2011-05-26) ------------------
> 
> Modified: zope.interface/trunk/src/zope/interface/interface.py 
> =================================================================== 
> --- zope.interface/trunk/src/zope/interface/interface.py      2011-08-04
> 13:44:20 UTC (rev 122461) +++
> zope.interface/trunk/src/zope/interface/interface.py  2011-08-04
> 14:18:37 UTC (rev 122462) @@ -682,7 +682,8 @@ return (n1 > n2) - (n1
> < n2)
> 
> def __hash__(self): -        return hash((self.__name__,
> self.__module__)) +        return hash((getattr(self, '__name__',
> ''), +                     getattr(self, '__module__', '')))

I don't think this is a regression -- how do you legitimately create an
interface without both those attributes?   The point of the comparison
function is to work even when handed a non-Interface object as one of
the two terms being compared, which doesn't apply to the case of a hash.
If there is code in zope.app.interface which is constructing a class
derived from Interface but which doesn't call Interface.__init__ before
hashing the instance, that code is *broken*, and should be fixed.


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk48WjQACgkQ+gerLs4ltQ7ceACcCIkqWBXaISkGj44RIFTPqdyx
d5kAn1H9biD8xF5T2Jf6kN/FQNBLRkbb
=aTGc
-----END PGP SIGNATURE-----

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to