8 Dec
2017
8 Dec
'17
10:59 a.m.
On Fri, 8 Dec 2017 11:41:10 +0100 Erik Bray <erik.m.bray@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.