Mike Bayer <mike...@zzzcomputing.com> writes:

> OK my change has revealed a bug in my test suite that wasn't catching
> that my change fails.   The C implementation uses the keymap for
> integers.   Where are you looking that it doesn't ?

Uhm, in current master resultproxy.c::

    static PyObject *
    BaseRowProxy_subscript(BaseRowProxy *self, PyObject *key)
    {
        ...
    #if PY_MAJOR_VERSION < 3
        if (PyInt_CheckExact(key)) {
            index = PyInt_AS_LONG(key);
        }
    #endif

        if (PyLong_CheckExact(key)) {
            index = PyLong_AsLong(key);
            ...
        } else if (PySlice_Check(key)) {
            values = PyObject_GetItem(self->row, key);
            ...
            return result;
        } else {
            record = PyDict_GetItem((PyObject *)self->keymap, key);
            ...
        }
        ...
    }
    
As you can see, the keymap attribute is accessed only when the key isn't
either an int or as a slice (under Py2 there's what seems a bug to me, that I
cured in my diff: the first "if" should end with an "else" clause)

Let me know how you prefer me going forward: I can easily try out your (now
reverted) change, but it's up to you.

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  |                 -- Fortunato Depero, 1929.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to