Re: [Python-Dev] pickle output not unique

2010-08-04 Thread Alexander Belopolsky
2010/8/4 Kristján Valur Jónsson : .. > Well, it is not _that_ dangerous.  It just causes cache misses when they > wouldn't be expected. > But since this has been brought up and dismissed in issue 8738, I won't > pursue this further. Don't read too much from the "dismissal" of issue 8738. I will

Re: [Python-Dev] pickle output not unique

2010-08-04 Thread Kristján Valur Jónsson
> -Original Message- > From: "Martin v. Löwis" [mailto:mar...@v.loewis.de] > Sent: 3. ágúst 2010 20:48 > To: Kristján Valur Jónsson > Cc: Python-Dev > Subject: Re: [Python-Dev] pickle output not unique > > > I just wanted to point this out. W

Re: [Python-Dev] pickle output not unique

2010-08-03 Thread Alexander Belopolsky
2010/8/3 "Martin v. Löwis" : .. > I think there are many other instances where values that compare equal > pickle differently in Python. Indeed. For example: >>> 1.0 == 1 True >>> dumps(1.0) == dumps(1) False or for objects of the same type >>> 0.0 == -0.0 True >>> dumps(0.0) == dumps(-0.0) Fa

Re: [Python-Dev] pickle output not unique

2010-08-03 Thread Alexander Belopolsky
2010/8/3 Kristján Valur Jónsson : .. > > These strings are different, presumably because of the (ob_refcnt == 1) > optimization used during object pickling. > I have recently closed a similar issue because it is not a bug and the problem is not present in 3.x: http://bugs.python.org/issue8738 .. >

Re: [Python-Dev] pickle output not unique

2010-08-03 Thread Martin v. Löwis
> I just wanted to point this out. We‘ll attempt some local workarounds > here, but it should otherwise be simple to modify pickling to optionally > turn off this optimization and always generate the same output > irrespective of the internal reference counts of the objects. I think there are man

[Python-Dev] pickle output not unique

2010-08-03 Thread Kristján Valur Jónsson
Hi there. I was made aware of this oddity here: import cPickle reffed = "xKITTENSx"[1:-1] print repr(cPickle.dumps(reffed)) print repr(cPickle.dumps("xKITTENSx"[1:-1])) These strings are different, presumably because of the (ob_refcnt == 1) optimization used during object pickling. This might c