PATCH: Compatibility with Python 2.6

Benoit Boissinot bboissin at gmail.com
Fri Apr 4 13:53:21 CDT 2008


On Fri, Apr 4, 2008 at 7:09 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> There are a couple of problems running Mercurial with Python 2.6:
>
>  1. Classes which are used as dictionary keys need a __hash__ method
>  (previously, just an __eq__ would do)
>  2. The sha module has been deprecated in favour of hashlib.
>
>  The attached patch fixes these issues, I believe (I've done minimal
>  testing, but I have not worked out how to run the test suite on
>  Windows yet to do anything more exhaustive). The changes I made are:
>
>  1. Add a __hash__ method to the 3 classes which define __eq__.

I had to do this change to make it pass the tests:
in commands.grep()
+
+        def __hash__(self):
+            return hash((self.line, self.linenum))

It is a bit surprising...

regards,

Benoit


More information about the Mercurial mailing list