Skip to content

Problem pickling length-1 boolean arrays (Trac #1802) #2395

@numpy-gitbot

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/1802 on 2011-04-18 by trac user eewallace, assigned to unknown.

If I pickle a dictionary containing two length one numpy arrays with dtype 'bool' and the same value (e.g. dict(a1=numpy.array([False]),a2=numpy.array([False]), when the data is unpickled, the resulting arrays contain references to the same boolean objects, so that changing the value of one of them changes both. The attached text file contains a transcript of a short IPython session illustrating the problem.
This seems to come up specifically with the standard pickle module, not with cPickle. It also occurs with arrays that are data members of separate class instances, which is where I first encountered it.
I've produced this on two Linux installations, one Arch Linux with python 2.7.1, and numpy 1.5.1, both built under gcc 4.5, the other with Red Hat 4.1, python 2.6.6, numpy 1.5.1 and gcc 4.1.

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