This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, methane, serhiy.storchaka
Date 2017-01-04.21:38:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I don't think we should put too much effort into preserving numpy behavior.  Consider this python 3.5 session:

>>> import numpy
>>> a = numpy.array([1])
>>> bytes(a)
__main__:1: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future
>>> a = numpy.array([2, 2])
>>> bytes(a)

It looks like this behavior is just an artifact of ndarray providing both __index__ and buffer protocol and not something thought out by numpy developers.

I wonder if we could check for buffer protocol support before detecting an integer argument?  I also recall a discussion of deprecating bytes(int) altogether.  See <>.
Date User Action Args
2017-01-04 21:38:21belopolskysetrecipients: + belopolsky, methane, serhiy.storchaka
2017-01-04 21:38:21belopolskysetmessageid: <>
2017-01-04 21:38:21belopolskylinkissue29159 messages
2017-01-04 21:38:21belopolskycreate