Re: [PATCH next 2/2] Remove python 2.5'isms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 09 June 2010, Sverre Rabbelier wrote:
> On Wed, Jun 9, 2010 at 23:24, Brandon Casey <casey@xxxxxxxxxxxxxxx> 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, <johan@xxxxxxxxxxx>
www.herland.net
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]