avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ham...@apache.org
Subject svn commit: r925135 - in /hadoop/avro/trunk: CHANGES.txt lang/py/src/avro/protocol.py
Date Fri, 19 Mar 2010 08:46:41 GMT
Author: hammer
Date: Fri Mar 19 08:46:41 2010
New Revision: 925135

URL: http://svn.apache.org/viewvc?rev=925135&view=rev
Log:
AVRO-251. Try to use hashlib in Python implementation and fall
back to md5 if we can't find it (Bruce Mitchener via hammer)


Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/lang/py/src/avro/protocol.py

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=925135&r1=925134&r2=925135&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Fri Mar 19 08:46:41 2010
@@ -14,6 +14,9 @@ Avro 1.3.2 (unreleased)
 
     AVRO-481. Buildbot warning fixes (Bruce Mitchener via massie)
 
+    AVRO-451. Try to use hashlib in Python implementation and fall
+    back to md5 if we can't find it (Bruce Mitchener via hammer)
+
   BUG FIXES
 
     AVRO-479. Fix 'sign' target in top-level build.sh to generate md5

Modified: hadoop/avro/trunk/lang/py/src/avro/protocol.py
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/py/src/avro/protocol.py?rev=925135&r1=925134&r2=925135&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/py/src/avro/protocol.py (original)
+++ hadoop/avro/trunk/lang/py/src/avro/protocol.py Fri Mar 19 08:46:41 2010
@@ -17,7 +17,10 @@
 Protocol implementation.
 """
 import cStringIO
-import md5
+try:
+  import hashlib
+except ImportError:
+  import md5
 try:
   import simplejson as json
 except ImportError:
@@ -96,7 +99,10 @@ class Protocol(object):
       self.set_prop('types', self._parse_types(types, type_names))
     if messages is not None:
       self.set_prop('messages', self._parse_messages(messages, type_names))
-    self._md5 = md5.new(str(self)).digest()
+    if hashlib:
+      self._md5 = hashlib.md5(str(self)).digest()
+    else:
+      self._md5 = md5.new(str(self)).digest()
 
   # read-only properties
   name = property(lambda self: self.get_prop('name'))



Mime
View raw message