Browse Source

Drop compatibility replacement for unpack_from.

Jelmer Vernooij 11 years ago
parent
commit
93260075e4
2 changed files with 1 additions and 15 deletions
  1. 0 11
      dulwich/_compat.py
  2. 1 4
      dulwich/pack.py

+ 0 - 11
dulwich/_compat.py

@@ -37,8 +37,6 @@ except ImportError:
     SEEK_CUR = 1
     SEEK_END = 2
 
-import struct
-
 
 def make_sha(source=''):
     """A python2.4 workaround for the sha/hashlib module fiasco."""
@@ -49,15 +47,6 @@ def make_sha(source=''):
         return sha1
 
 
-def unpack_from(fmt, buf, offset=0):
-    """A python2.4 workaround for struct missing unpack_from."""
-    try:
-        return struct.unpack_from(fmt, buf, offset)
-    except AttributeError:
-        b = buf[offset:offset+struct.calcsize(fmt)]
-        return struct.unpack(fmt, b)
-
-
 try:
     all = all
 except NameError:

+ 1 - 4
dulwich/pack.py

@@ -53,10 +53,7 @@ else:
     has_mmap = True
 import os
 import struct
-try:
-    from struct import unpack_from
-except ImportError:
-    from dulwich._compat import unpack_from
+from struct import unpack_from
 import sys
 import warnings
 import zlib