http://bugs.python.org/review/1172711/diff/3310/10310
File Modules/arraymodule.c (right):
http://bugs.python.org/review/1172711/diff/3310/10310#newcode362
Modules/arraymodule.c:362: q_getitem(arrayobject *ap, int i)
On 2011/09/11 10:53:59, skrah wrote:
> 'int i' should be 'Py_ssize_t i' (also in other places).
Fixed.
http://bugs.python.org/review/1172711/diff/3310/10310#newcode371
Modules/arraymodule.c:371: if (!PyArg_Parse(v, "L;array item must be integer",
&x))
On 2011/09/11 10:53:59, skrah wrote:
> Why not use PyLong_AsLongLong() directly. I see that existing code also uses
> PyArg_Parse(), perhaps new code shouldn't.
The only reason that I can see is that 'PyArg_Parse' is more strict. For
example, for the integer types implicit conversions from float are *not*
allowed. If this code was changed to use 'PyLong_AsLongLong', then things like:
>>> array('q', [1.234567])
would work, which we don't want.
http://bugs.python.org/review/1172711/diff/3310/10310#newcode394
Modules/arraymodule.c:394: else {
On 2011/09/11 10:53:59, skrah wrote:
> All PyArg_Parse() does in the test suite is raise a TypeError. Is there a
> reason in py3k for not raising TypeError directly in the else clause?
Maybe the tests needed extending. Replacing this code with a TypeError would
not handle the following case correctly:
class T(object):
def __init__(self, value):
self.value = value
def __int__(self):
return self.value
array.array('Q', [T(187)])
Issue 1172711: long long support for array module
Created 7 years, 2 months ago by orenti_users.sourceforge.net
Modified 8 months, 2 weeks ago
Reviewers: skrah, meadori
Base URL: None
Comments: 6