comparison mercurial/util.py @ 23832:62f41f251e52

unpacker: check the right exception type for 2.4
author Matt Mackall <mpm@selenic.com>
date Tue, 13 Jan 2015 16:15:02 -0800
parents 94951db84fc0
children 6c44cef5baa2
comparison
equal deleted inserted replaced
23831:0ab23a48b9a7 23832:62f41f251e52
232 def unpacker(fmt): 232 def unpacker(fmt):
233 """create a struct unpacker for the specified format""" 233 """create a struct unpacker for the specified format"""
234 try: 234 try:
235 # 2.5+ 235 # 2.5+
236 return struct.Struct(fmt).unpack 236 return struct.Struct(fmt).unpack
237 except NameError: 237 except AttributeError:
238 # 2.4 238 # 2.4
239 return lambda buf: struct.unpack(fmt) 239 return lambda buf: struct.unpack(fmt)
240 240
241 def popen2(cmd, env=None, newlines=False): 241 def popen2(cmd, env=None, newlines=False):
242 # Setting bufsize to -1 lets the system decide the buffer size. 242 # Setting bufsize to -1 lets the system decide the buffer size.