[pypy-svn] r15327 - in pypy/dist: lib-python/modified-2.4.1 pypy/lib

ale at codespeak.net ale at codespeak.net
Fri Jul 29 11:55:17 CEST 2005


Author: ale
Date: Fri Jul 29 11:55:15 2005
New Revision: 15327

Added:
   pypy/dist/lib-python/modified-2.4.1/binhex.py
      - copied, changed from r15319, pypy/dist/lib-python/2.4.1/binhex.py
Modified:
   pypy/dist/pypy/lib/struct.py
Log:
changed binhex.py to use unsigned short in crc instead of signed short. reverted previous checkin to struct

Copied: pypy/dist/lib-python/modified-2.4.1/binhex.py (from r15319, pypy/dist/lib-python/2.4.1/binhex.py)
==============================================================================
--- pypy/dist/lib-python/2.4.1/binhex.py	(original)
+++ pypy/dist/lib-python/modified-2.4.1/binhex.py	Fri Jul 29 11:55:15 2005
@@ -217,7 +217,7 @@
     def _writecrc(self):
         # XXXX Should this be here??
         # self.crc = binascii.crc_hqx('\0\0', self.crc)
-        self.ofp.write(struct.pack('>h', self.crc))
+        self.ofp.write(struct.pack('>H', self.crc))
         self.crc = 0
 
     def write(self, data):

Modified: pypy/dist/pypy/lib/struct.py
==============================================================================
--- pypy/dist/pypy/lib/struct.py	(original)
+++ pypy/dist/pypy/lib/struct.py	Fri Jul 29 11:55:15 2005
@@ -102,7 +102,7 @@
 def pack_signed_int(number,size,le):
     if not isinstance(number, (int,long)):
         raise StructError,"argument for i,I,l,L,q,Q,h,H must be integer"
-    if  number < -1*2**(8*size-1):  #number > 2**(8*size-1)-1 or
+    if  number > 2**(8*size-1)-1 or number < -1*2**(8*size-1):
         raise OverflowError,"Number:%i too large to convert" % number
     return pack_int(number,size,le)
 



More information about the Pypy-commit mailing list