Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(11543)

#1172711: long long support for array module

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 5 months ago by orenti
Modified:
8 years ago
Reviewers:
stefan-usenet, meadori
CC:
orenti_users.sourceforge.net, mark.dickinson, haypo, ocean-city, python_craig.mcqueen.id.au, skrah, meadori, maatt, devnull_psf.upfronthosting.co.za, devnull_psf.upfronthosting.co.za, maatt
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Patch Set 3 #

Patch Set 4 #

Total comments: 6

Patch Set 5 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/array.rst View 1 2 1 chunk +39 lines, -27 lines 0 comments Download
Lib/test/test_array.py View 1 2 3 4 3 chunks +21 lines, -0 lines 0 comments Download
Modules/arraymodule.c View 1 2 3 4 5 chunks +78 lines, -1 line 0 comments Download

Messages

Total messages: 2
stefan-usenet_bytereef.org
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) 'int i' should be 'Py_ssize_t ...
8 years ago #1
meadori
8 years ago #2
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)])
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+