Issue 31097: itertools.islice not accepting np.int64 (original) (raw)

Created on 2017-08-01 13:23 by braaannigan, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (6)
msg299617 - (view) Author: LB (braaannigan) Date: 2017-08-01 13:23
The error arises when this code is used: itertools.islice( [3, 4, 5], np.int64(2) ) but not with this itertools.islice([3,4,5], 2)
msg299618 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-08-01 14:14
See http://bugs.python.org/issue30537
msg299620 - (view) Author: LB (braaannigan) Date: 2017-08-01 15:07
Thanks Ray. The use case is here: https://stackoverflow.com/questions/45356718/saving-matplotlib-animation-leads-to-error/45438057#45438057 I'm going to suggest a workaround in matplotlib for the moment. Changing type in this use case shouldn't be a big issue, it only happens once for each animation created.
msg299625 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2017-08-01 17:55
That actually looks as though it may be worth a bug report to the matplotlib folks.
msg299628 - (view) Author: LB (braaannigan) Date: 2017-08-01 18:55
Hi Mark - I've done that here: https://github.com/matplotlib/matplotlib/issues/8973 Liam
msg299769 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-08-05 03:07
LB, an exception is a graceful shutdown, not a crash. A crash is a seg fault, core dump, or an OS message 'Your app has stopped unexpectedly'. In #30537, the exception was regarded as expected, not a bug, and changing islice to accept np ints was regarded as an enhancement, and therefore limited to 3.7
History
Date User Action Args
2022-04-11 14:58:49 admin set github: 75280
2017-08-05 03:07:56 terry.reedy set nosy: + terry.reedymessages: +
2017-08-05 03:02:31 terry.reedy set status: open -> closedtype: crash -> behaviorsuperseder: Using PyNumber_AsSsize_t in itertools.isliceresolution: duplicatestage: resolved
2017-08-01 18:55:01 braaannigan set messages: +
2017-08-01 17:55:57 mark.dickinson set nosy: + mark.dickinsonmessages: +
2017-08-01 15:07:18 braaannigan set messages: +
2017-08-01 14:14:53 rhettinger set nosy: + rhettingermessages: +
2017-08-01 13:23:06 braaannigan create