[Python-Dev] Why is nb_inplace_add copied to sq_inplace_concat?
ncoghlan at gmail.com
Fri May 17 05:41:32 CEST 2013
On Fri, May 17, 2013 at 1:38 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Fri, May 17, 2013 at 9:17 AM, Matt Newell <newellm at blur.com> wrote:
>> I don't really understand what the fixup_slot_dispatchers function is doing,
>> but it does seem like there must be a bug either in what it's doing, or in
>> PyNumber_InPlaceAdd's handling of a NotImplemented return value from
> I didn't read your post in detail, but operand precedence in CPython
> is known to be broken for types which only populate the sq_* slots
> without also populating the corresponding nb_* slots:
Oops, I meant to state that one of the consequences of the bug is that
returning NotImplemented from the sq_* methods doesn't work at all -
it's never checked and thus never turned into a TypeError. That's why
changing to delegation from the nb_* slots is the most promising
approach - all that handling is there and correct for the numeric
types, but pure sequence types (which can only be created from C code)
bypass that handling.
I *did* read enough of the original post to know that was the symptom
you were seeing, I just failed to mention that in my initial reply...
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev