Skip to content

data leakage with S0 in record dtype (Trac #1992) #2585

Closed

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/1992 on 2011-12-12 by trac user hpaulj, assigned to unknown.

As of numpy 1.5.1 (and earlier)

>>> x = np.zeros(1, 'S,i')
>>> x['f0']='A'
>>> x
array([('', 65)], dtype=[('f0','|S0'),('f1','<i4')])

In contrast, if the assigned dtype is
'S1,i'
, x is then ('A',0)

So not only is there ambiguity as to what a 'S' dtype produces (as discussed in other tickets), but assignment to that record leaks over to the adjacent field.

I first encountered this in an introduction to numpy for Ironpython, but it occurs in all versions that I've tested.

Activity

  1. ahaldane commented on Jun 2, 2016

    @ahaldane
    Member

    Fixed by #6430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions