[Python-bugs-list] [ python-Bugs-420828 ] Marshal fails on load of big tuple.
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 02 May 2001 12:46:44 -0700
Bugs item #420828, was updated on 2001-05-02 12:46
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=420828&group_id=5470
Category: Windows
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Marshal fails on load of big tuple.
Initial Comment:
##marshalBug.py
## This is code that demonstrates the bug
## Bug only occurs with marshal load and save, not loads and saves,
## Bug (to my knowledge) occurs only in Windows distribution (Tested on linux)
##
## On Idle command line bug can be duplicated with following:
##
#>>> f.close()
#>>> f = open("C:\temp\deleteme","w")
#>>> marshal.dump((12999999999999999999999999999999999999999977777777777777777777
#77777777777777777777777777777777777777777777777777777777777777777777777777777777
#77777777777777777777777777777777777777777777777777777777777777777777777777777777
#77777777777777777775555555555555555555555555555555555333333333333333333333333333
#333333333333333333333335555555555555555L, 12222222222222222222222222222222222222
#22222224444444444444444444444444444444444444888888888888888888888888888888888888
#88889999999999999999999999999999999999999999999999999999999999900000000000000000
#000000000088888888888888888888888888888888888888L),f)
#>>> f.close()
#>>> f = open("C:\temp\deleteme","r")
#>> marshal.load(f)
#(1299999999999999999999999999999999999999997777777777777777777777777777777777777
#77777777777777777777777777777777777777777777777777777777777777777777777777777777
#77777777777777777777777777777777777777777777777777777777777777777777777777777777
#77555555555555555555555555555555555533333333333333333333333333333333333333333333
#3333335555555555555555L, 4474897019813323481254923506055493475928166048940730464
#14109805177692967484150062868771650107391063365906217439770564386204965711909753
#84487052159509613681529022093399596597392467587045506856658934454268182437193534
#6828317880575604459910185571552824L)
#>>> f.close()
import marshal
## Test1
f = open("C:\temp\deleteme","w")
a =
1299999999999999999999999999999999999999997777777777777777777777777777777777777777
7
7777777777777777777777777777777777777777777777777777777777777777777777777777777777
7
7777777777777777777777777777777777777777777777777777777777777777777777777775555555
5
5555555555555555555555555533333333333333333333333333333333333333333333333333555555
5
555555555L
b =
1222222222222222222222222222222222222222222224444444444444444444444444444444444444
8
8888888888888888888888888888888888888889999999999999999999999999999999999999999999
9
99999999999999900000000000000000000000000088888888888888888888888888888888888888L
marshal.dump((a,b,),f)
f.close()
f = open("C:\temp\deleteme","r")
x,y = marshal.load(f)
f.close()
if a == x:
print "First element of Tuple OK"
else:
print "First element of Tuple Fails with:"
print a,"!=",x
if b == y:
print "Second of Tuple OK"
else:
print "Second element of Tuple Fails with:"
print b,"!=",y
## Test2: Works with smaller integers.
##f = open("C:\temp\deleteme","w")
##a = 1299999999999999999999L
##b = 1222222222222222222222L
##marshal.dump((a,b,),f)
##f.close()
##f = open("C:\temp\deleteme","r")
##x,y = marshal.load(f)
##f.close()
##if a == x:
## print "First element of Tuple OK"
##else:
## print a,"!=",x
##if b == y:
## print "Second element of Tuple OK"
##else:
## print b,"!=",y
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=420828&group_id=5470