comparison mercurial/util.py @ 25209:277a535c0b3a

util: drop the compatibility with Python 2.4 unpacker Python 2.4 compatibility have packed and sailed.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 18 May 2015 16:54:21 -0500
parents ac2e66f481c9
children b58dde1bb32f
comparison
equal deleted inserted replaced
25208:5a6820f8da4d 25209:277a535c0b3a
232 import subprocess 232 import subprocess
233 closefds = os.name == 'posix' 233 closefds = os.name == 'posix'
234 234
235 def unpacker(fmt): 235 def unpacker(fmt):
236 """create a struct unpacker for the specified format""" 236 """create a struct unpacker for the specified format"""
237 try: 237 return struct.Struct(fmt).unpack
238 # 2.5+
239 return struct.Struct(fmt).unpack
240 except AttributeError:
241 # 2.4
242 return lambda buf: struct.unpack(fmt, buf)
243 238
244 def popen2(cmd, env=None, newlines=False): 239 def popen2(cmd, env=None, newlines=False):
245 # Setting bufsize to -1 lets the system decide the buffer size. 240 # Setting bufsize to -1 lets the system decide the buffer size.
246 # The default for bufsize is 0, meaning unbuffered. This leads to 241 # The default for bufsize is 0, meaning unbuffered. This leads to
247 # poor performance on Mac OS X: http://bugs.python.org/issue4194 242 # poor performance on Mac OS X: http://bugs.python.org/issue4194