Daniel wrote:
> The binascii crc32 fallback seems to also return signed integers.
> Maybe forcing self.value to be unsigned could prevent a future
> conflict between binascii crc32 (signed) and zlib crc32 (unsigned).

Reading

http://mail.python.org/pipermail/python-3000/2008-March/012615.html
http://mail.python.org/pipermail/python-dev/2006-May/065452.html

and other sources, I think the most compatible fix is to ride the tide
and use signed for py <= 2.6 and unsigned for >= py 3.0 to make it
futureproof when 3.0 enters mainstream.

For example:

def digest(self):
  # crc32 functions are signed in python <= 2.6.x and unsigned in 3.0+
  version = string.split(string.split(sys.version)[0], ".")
  if map(int, version) < [2, 7]:
     return struct.pack('>i',self.value)
  else:
     return struct.pack('>I',self.value)







--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to