Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 171431 Details for
Bug 246406
[PATCH] dev-python/pycrypto-2.0.1-r6 deprecation warnings w/ python-2.6
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch from upstream
pycrypto-2.0.1-python-2.6-hashlib.patch (text/plain), 1.75 KB, created by
Christian Becke
on 2008-11-11 15:50:28 UTC
(
hide
)
Description:
patch from upstream
Filename:
MIME Type:
Creator:
Christian Becke
Created:
2008-11-11 15:50:28 UTC
Size:
1.75 KB
patch
obsolete
>From: Dwayne C. Litzenberger <dlitz@dlitz.net> >Date: Sun, 14 Sep 2008 19:30:59 +0000 (-0400) >Subject: Python 2.6 compatibility: When possible, use hashlib instead of the deprecated 'md5... >X-Git-Url: http://gitweb.pycrypto.org/?p=crypto%2Fpycrypto-2.x.git;a=commitdiff_plain;h=d2311689910240e425741a546576129f4c9735e2 > >Python 2.6 compatibility: When possible, use hashlib instead of the deprecated 'md5' and 'sha' modules >--- > >diff --git a/Hash/MD5.py b/Hash/MD5.py >index bdbc62a..e79a85f 100644 >--- a/Hash/MD5.py >+++ b/Hash/MD5.py >@@ -3,11 +3,21 @@ > > __revision__ = "$Id$" > >-from md5 import * >+__all__ = ['new', 'digest_size'] > >-import md5 >-if hasattr(md5, 'digestsize'): >- digest_size = digestsize >- del digestsize >-del md5 >+try: >+ # The md5 module is deprecated in Python 2.6, so use hashlib when possible. >+ import hashlib >+ def new(data=""): >+ return hashlib.md5(data) >+ digest_size = new().digest_size >+ >+except ImportError: >+ from md5 import * >+ >+ import md5 >+ if hasattr(md5, 'digestsize'): >+ digest_size = digestsize >+ del digestsize >+ del md5 > >diff --git a/Hash/SHA.py b/Hash/SHA.py >index dc05502..f4128ec 100644 >--- a/Hash/SHA.py >+++ b/Hash/SHA.py >@@ -3,9 +3,19 @@ > > __revision__ = "$Id$" > >-from sha import * >-import sha >-if hasattr(sha, 'digestsize'): >- digest_size = digestsize >- del digestsize >-del sha >+__all__ = ['new', 'digest_size'] >+ >+try: >+ # The md5 module is deprecated in Python 2.6, so use hashlib when possible. >+ import hashlib >+ def new(data=""): >+ return hashlib.sha1(data) >+ digest_size = new().digest_size >+ >+except ImportError: >+ from sha import * >+ import sha >+ if hasattr(sha, 'digestsize'): >+ digest_size = digestsize >+ del digestsize >+ del sha
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 246406
:
171431
|
171698