[Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

Antoine Pitrou solipsis at pitrou.net
Fri Dec 8 13:11:20 EST 2017


On Fri, 8 Dec 2017 15:12:30 +0100
Erik Bray <erik.m.bray at gmail.com> wrote:
> On Fri, Dec 8, 2017 at 1:52 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> > On Fri, 8 Dec 2017 14:30:00 +0200
> > Serhiy Storchaka <storchaka at gmail.com>
> > wrote:  
> >>
> >> NumPy integers implement __index__.  
> >
> > That doesn't help if a function calls e.g. PyLong_AsLongAndOverflow().  
> 
> Right--pointing to __index__ basically implies that PyIndex_Check and
> subsequent PyNumber_AsSsize_t than there currently are.  That I could
> agree with but then it becomes a question of where are those cases?
> And what do with, e.g. interfaces like PyLong_AsLongAndOverflow().
> Add more PyNumber_ conversion functions?

We would probably need more PyNumber_ conversion functions indeed.

Regards

Antoine.




More information about the Python-ideas mailing list