On Fri, 8 Dec 2017 11:41:10 +0100
Erik Bray <erik.m.b...@gmail.com> wrote:
> 
> I ran into this because I was passing an object that implements
> __int__ to the maxlen argument to deque().  On Python 2 this used
> PyInt_AsSsize_t which does fall back to calling __int__, whereas
> PyLong_AsSsize_t does not.

It should probably call PyNumber_AsSsize_t instead (which will call
__index__, which is the right thing here).

> I think this inconsistency should be fixed, unless there's some reason
> for it I'm not seeing.

That sounds reasonable to me.

Regards

Antoine.


_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to