[Patches] PyMarshal_WriteLongToFile: writes 'long' or 32-bit integer?

Greg Stein gstein@lyra.org
Fri, 2 Jun 2000 15:26:21 -0700 (PDT)

On Fri, 2 Jun 2000, Trent Mick wrote:
> On Fri, Jun 02, 2000 at 09:45:25PM +0200, Peter Funk wrote:
> > > 3. - change PyMarshal_WriteLongToFile to raise an exception if the long
> > > 	 overflows a 32-bit range
> > 
> > We should try to achieve the following goal:  .pyc files should be portable
> > from 32 bit systems to 64 bit systems and vice versa.  This means 
> > always truncating to 32 bits and raising an exception, if an overflow
> > occurs.  
> >
> Or offer PyMarshal_WriteInt32ToFile for import.c and import.c itself can do
> the overflow checking on the time stamp. That is the RIght THing(TM) IMO.
> Anyway, my question was intended to be more about the subtlety of marshal
> functions rather than the .pyc file headers. No question that the .pyc's
> should be portable.

I think Peter was referring to integers embedded in the marshalled code in
a .pyc, rather than the timestamp.

Basically: a marshalled string *must* be portable. That is effectively a
language definition.

I'm with Peter on this one: marshal.c should raise an exception if an
integer overflows the 32-bit value.
[ the app writer should use a Long for max portability ]


Greg Stein, http://www.lyra.org/