From: Johan Herland Date: Wed, 09 Jun 2010 22:40:54 GMT Subject: Re: [PATCH next 2/2] Remove python 2.5'isms Message-ID: <201006100040.54375.johan@herland.net> In-Reply-To: On Wednesday 09 June 2010, Sverre Rabbelier wrote: > On Wed, Jun 9, 2010 at 23:24, Brandon Casey wrote: > > The following python 2.5 features were worked around: > > Thanks for fixing this, although it makes me sad to see the code > uglify the way it has :P. I guess that's the pain of backwards > compatibility. I agree with Sverre's painful acceptance, but I believe something must be done with the s/hashlib/sha/ changes. On my Python v2.6.5. I get the following: >>> import sha __main__:1: DeprecationWarning: the sha module is deprecated; use the hashlib module instead This is added to the output of every python program that imports sha. I believe we should really try to use the hashlib module when available, and only fall back to sha when necessary. Please use something like this instead: # hashlib is only available in python >= 2.5 try: import hashlib _digest = hashlib.sha1 except ImportError: import sha _digest = sha.sha so that we don't get the hideous DeprecationWarning. ...Johan -- Johan Herland, www.herland.net