removed when support for older versions of Python is removed.
if buf:
try:
+ # Python >=3.2
data = buf.tobytes()
except AttributeError:
data = buf.tostring()
except TypeError:
# array.tofile() doesn't work with GzipFile
try:
+ # Python >=3.2
data = buf.tobytes()
except AttributeError:
data = buf.tostring()
eof = True
else:
try:
+ # Python >=3.2
data.append(a.tobytes())
except AttributeError:
data.append(a.tostring())
eof = True
else:
try:
+ # Python >=3.2
data.append(buf.tobytes())
except AttributeError:
data.append(buf.tostring())
return None
try:
+ # Python 2.7 or >=3.2
iterate = self._herdstree.iter
except AttributeError:
iterate = self._herdstree.getiterator
self._useflags = tuple()
else:
try:
+ # Python 2.7 or >=3.2
iterate = self._xml_tree.iter
except AttributeError:
iterate = self._xml_tree.getiterator
a.append((myint >> 8 ) & 0xff)
a.append(myint & 0xff)
try:
+ # Python >=3.2
return a.tobytes()
except AttributeError:
return a.tostring()