[Python-Dev] id() on Win64 (was: CVS: python/dist/src/Python bltinmodule.c,2.162,2.163)

Finn Bock bckfnn@worldonline.dk
Thu, 29 Jun 2000 16:43:09 GMT


[Tim]

>So it's possible there for one of these be true:
>
>    id(x) == id(y) and x is not y
>    id(x) != id(x)
>
>?

Yes, the first.


d = {}
cnt = 0

for i in xrange(100000):
    s = "test" + `i`
    j = id(s)
    if d.has_key(j):
        cnt = cnt + 1
    d[j] = s

print cnt, "failures"

Will print 500+ failures when run by JPython & JDK1.3 on win2k.

>Then that's a bug in JPython or hotspot.  Know which?

JPython.

> Filed a bug report?

Years ago <wink>:
  http://www.python.org/jpython-bugs/incoming?id=118

>In CPython, we just use the address of an object's header, and as CPython
>never moves an object's header in memory, the good stuff follows trivially.
>Don't know what JPython tries to do, but it's bound to be harder there (as
>Java can move memory around).

That is also my guess. I cannot see what we can do about it, except inform
users that not all python platform behave exactly the same. Which is why I
brought it up.

regards,
finn