This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients christian.heimes, fredrikj, mark.dickinson, pernici
Date 2008-10-07.09:15:58
SpamBayes Score 4.1633363e-15
Marked as misclassified No
Message-id <1223370963.45.0.584915490482.issue3944@psf.upfronthosting.co.za>
In-reply-to
Content
It looks as though changing PyLong_SHIFT to 30 everywhere is much simpler 
than I feared.  Here's a short patch that does exactly that.  It:

 - changes the definitions in longintrepr.h
 - changes marshal.c to write digits as longs, not shorts
 - adds some casts to longobject.c (most of which should really
   have been there already---clearly Python's never encountered
   a machine where ints are only 2 bytes long, even though the
   standard seems to permit it).

With this patch, all tests pass on my machine with the exception of
the getsizeof tests in test_sys;  and sys.getsizeof is working fine---it's 
the tests that need to be changed.

Still to do:
 - use uint64 and uint32 instead of unsigned long long and unsigned long,
   when available;  this avoids wasting lots of space on platforms
   where a long is 64 bits.
 - provide fallback definitions for platforms that don't have any 64-bit
   type available
 - (?)expose the value of PyLong_SHIFT to Python somewhere (in sys?);  then
   the getsizeof tests could use this value to determine whether a digit
   is expected to take 2 bytes or 4 (or ...)
History
Date User Action Args
2008-10-07 09:16:03mark.dickinsonsetrecipients: + mark.dickinson, pernici, christian.heimes, fredrikj
2008-10-07 09:16:03mark.dickinsonsetmessageid: <1223370963.45.0.584915490482.issue3944@psf.upfronthosting.co.za>
2008-10-07 09:16:02mark.dickinsonlinkissue3944 messages
2008-10-07 09:16:01mark.dickinsoncreate