[Python-Dev] id() on Win64 (was: CVS: python/dist/src/Python bltinmodule.c,2.162,2.163)
Greg Stein
gstein@lyra.org
Wed, 28 Jun 2000 14:48:00 -0700
On Wed, Jun 28, 2000 at 02:12:28PM -0700, Guido van Rossum wrote:
>...
> - chunk #2:
> The id() function guarantees a unique return value for different
> objects. It does this by returning the pointer to the object. By
> returning a PyInt, on Win64 (sizeof(long) < sizeof(void*)) the pointer
> is truncated and the guarantee may be proven false. The appropriate
> return function is PyLong_FromVoidPtr, this returns a PyLong if that
> is necessary to return the pointer without truncation.
>
> [GvR: note that this means that id() can now return a long on Win32
> platforms. This *might* break some code...]
Strictly speaking: the Long only occurs on Win64 platforms.
I would guess that it is also possible on say, an Alpha running Linux.
Presuming that has 64-bit pointers(?).
Regardless: yes, it can certainly break some code. IMO, if any code out
there makes any kinds of assumptions about id(), then they deserve to be
broken :-)
Cheers,
-g
--
Greg Stein, http://www.lyra.org/