[Python-Dev] sizeof(long) != sizeof(void*)

Tim Peters tim.one at comcast.net
Tue Aug 5 22:19:41 EDT 2003

> Ah, and I mean <type 'int'>, when I say <type 'integer'> :-)

In that case, no, Python has no intent of claiming that a Python int can
hold a machine address.  It does intend that a machine address can be held a
Python integer, but doesn't promise that such an integer won't be a Python
long.  So the array buffer_info test is making a bogus assumption (and the
intended way to repair that was given before).

The other test insisting that id() == hash() for an instance of a
user-defined class that doesn't define __hash__ is also making a bogus
assumption, since hash() results are specifically Python ints today while
id() results are Python integers (ints or longs).  I'm not sure what that
test was *trying* to check; the test looked pretty useless to me.

I expect that both these tests were introduced after Trent finished the
Win64 port (test_descr.py certainly came after that port), so simply haven't
been run on Win64 before.

If Win64 has a future, I suppose it would be good to repair this stuff; but
I don't expect any other platform in my lifetime to decide to make
sizeof(void*) > sizeof(long), so it's tempting to take the lack of previous
reports of Win64 test failures as evidence about that platform's viability.

More information about the Python-Dev mailing list