[issue24313] json fails to serialise numpy.int64

Nathaniel Smith report at bugs.python.org
Mon Jan 4 06:20:23 EST 2016


Nathaniel Smith added the comment:

Nothing's changed in python 2.7. Basically: (a) no numpy ints have ever serialized in py3. (b) in py2, either np.int32 *xor* np.int64 will serialize correctly, and which one it is depends on sizeof(long) in the C compiler used to build Python. (This follows from the fact that in py2, the Python 'int' type is always the same size as C 'long'.)

So the end result is: on OS X and Linux, 32-bit Pythons can JSON-serialize np.int32 objects, and 64-bit Pythons can JSON-serialize np.int64 objects, because 64-bit OS X and Linux is ILP64. On Windows, both 32- and 64-bit Pythons can JSON-serialize np.int32 objects, and can't serialize np.int64 objects, because 64-bit Windows is LLP64.

----------

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


More information about the Python-bugs-list mailing list