[NumPy-Tickets] [NumPy] #2024: NULL bytes removed from end of string in NumPy array
NumPy Trac
numpy-tickets@scipy....
Fri Jun 15 15:30:57 CDT 2012
#2024: NULL bytes removed from end of string in NumPy array
------------------------------------+---------------------------------------
Reporter: edcjones | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.core | Version: 1.4.1
Keywords: NULL terminated string |
------------------------------------+---------------------------------------
Comment(by edcjones):
I am currently using up=to=date Debian testing (wheezy), amd64
architecture. I have packages python3, version 3.2.3~rc1-2, and
python3-numpy, version 1:1.6.2-1.
Numpy should not treat a Python 3.2 bytes object as a NULL terminated
string because bytes objects can contain NULLs.
Program:
#! /usr/bin/env python3.2
import numpy
DT = numpy.dtype((bytes, 4))
print(DT.type)
b = b'\0bc\0'
print(len(b), b)
arr = numpy.array([b], dtype=DT)
print(len(arr[0]), arr[0])
Output:
<class 'numpy.bytes_'>
4 b'\x00bc\x00'
3 b'\x00bc'
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/2024#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list