[issue24313] json fails to serialise numpy.int64

Antoine Pitrou report at bugs.python.org
Fri May 29 01:10:57 CEST 2015


Antoine Pitrou added the comment:

> It looks like json doesn't check for __index__, and I wonder if it should.

I don't know. Simply, under 2.7, int64 inherits from int:

>>> np.int64.__mro__
(<type 'numpy.int64'>, <type 'numpy.signedinteger'>, <type 'numpy.integer'>, <type 'numpy.number'>, <type 'numpy.generic'>, <type 'int'>, <type 'object'>)

while it doesn't under 3.x:

>>> np.int64.__mro__ 
(<class 'numpy.int64'>, <class 'numpy.signedinteger'>, <class 'numpy.integer'>, <class 'numpy.number'>, <class 'numpy.generic'>, <class 'object'>)

----------
nosy: +pitrou
type: crash -> enhancement
versions: +Python 3.6 -Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24313>
_______________________________________


More information about the Python-bugs-list mailing list