This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author trent
Recipients loewis, trent
Date 2008-03-20.22:00:40
SpamBayes Score 0.24174212
Marked as misclassified No
Message-id <1206050442.67.0.496216797611.issue2440@psf.upfronthosting.co.za>
In-reply-to
Content
test_getargs2 fails on Win x64:

test_getargs2 is failing on Windows x64:
test test_getargs2 failed -- Traceback (most recent call last):
  File
"S:\buildbots\python.x64\3.0.nelson-win64\build\lib\test\test_getargs2.py",
line 190, in test_n
    self.failUnlessEqual(99, getargs_n(Long()))
TypeError: 'Long' object cannot be interpreted as an integer

The problem is twofold: case 'n' on Win x64 (where SIZEOF_SIZE_T !=
SIZEOF_LONG) had a broken code path and needed updating.  Also, the
fallback to 'l' for systems where SIZEOF_SIZE_T == SIZEOF_LONG wasn't
correct -- it should still do a PyNumber_Index() check, and then use
PyLong_AsSize_t() to extract the value.

The attached patch corrects the behaviour on 32-bit and 64-bit systems,
including Windows.  However, it has now uncovered another bug in Windows
x64:

>>> from _testcapi import getargs_n
>>> getargs_n(sys.maxsize)
9223372036854775807
>>> getargs_n(-sys.maxsize)
1
>>> getargs_n(-sys.maxsize-1)
0

After a bit of investigation with Martin, the logic in PyLong_AsSize_t()
is incorrect and needs to be reworked to handle negative maximums properly.
History
Date User Action Args
2008-03-20 22:00:42trentsetspambayes_score: 0.241742 -> 0.24174212
recipients: + trent, loewis
2008-03-20 22:00:42trentsetspambayes_score: 0.241742 -> 0.241742
messageid: <1206050442.67.0.496216797611.issue2440@psf.upfronthosting.co.za>
2008-03-20 22:00:42trentlinkissue2440 messages
2008-03-20 22:00:41trentcreate