marshal bug?

2007-09-28 Thread Anurag
I have been chasing a problem in my code since hours and it bolis down to this import marshal marshal.dumps(str(123)) != marshal.dumps(str(123)) Can someone please tell me why? when str(123) == str(123) or are they different? it also means that if s = str(123) marshal.dumps(s) !=

Re: marshal bug?

2007-09-28 Thread Gary Herron
Anurag wrote: I have been chasing a problem in my code since hours and it bolis down to this import marshal marshal.dumps(str(123)) != marshal.dumps(str(123)) Can someone please tell me why? when str(123) == str(123) or are they different? it also means that if s = str(123)

Re: marshal bug?

2007-09-28 Thread David
On 9/28/07, Anurag [EMAIL PROTECTED] wrote: I have been chasing a problem in my code since hours and it bolis down to this import marshal marshal.dumps(str(123)) != marshal.dumps(str(123)) I'm not sure why, but marshal does dump the 2 differently. ie: marshal.dumps(str(123))

Re: marshal bug?

2007-09-28 Thread David
I'm not sure why, but marshal does dump the 2 differently. ie: marshal.dumps(str(123)) 's\x03\x00\x00\x00123' marshal.dumps(str(123)) 't\x03\x00\x00\x00123' I've just checked the source [1]. 's' refers to a regular string, 't' refers to an interned[2] string. In other words the

Re: marshal bug?

2007-09-28 Thread Anurag
Thanks for the reply. It seems problem is due to Any string in Python can be interned or not, the difference being how/where the value is stored internally. The marshal module includes such information in its output. What you are doing is probably considered a misuse of the marshal module.

Re: marshal bug?

2007-09-28 Thread Gabriel Genellina
En Fri, 28 Sep 2007 04:26:39 -0300, Anurag [EMAIL PROTECTED] escribi�: Now is there a easy way to by pass it (hack around it) I tried various options but all fail e.g. i= 123; marshal.dumps(%d%123) != marshal.dumps(%d%i) You can't. Don't use marshal to compare objects. You appear to assume

Re: marshal bug?

2007-09-28 Thread Martin v. Löwis
[1] http://coverage.livinglogic.de/Python/marshal.c.html. (Actually, I checked the downloaded bz2, but this is the only URL for marshal.c I could find) A better URL is http://svn.python.org/projects/python/trunk/Python/marshal.c or http://svn.python.org/view/python/trunk/Python/marshal.c

[Marshal Bug] Was Re: curious problem with large numbers

2005-04-08 Thread Michael Spencer
OK - I think this is it: My last post fingering pickle was almost but not quite right*. Actually the cuplrit is marshal, which produces the incorrect result that was noted. The bug has nothing to do with IDLE, except that it uses marshal for inter-process communication. Here's the failure