Skip to content

sumatra.parameters.NTParameterSet cannot be modified after unpickling #383

@abast

Description

@abast

After initializing a sumatra.parameters.NTParameterSet, it can be modified:

import sumatra.parameters
param = sumatra.parameters.NTParameterSet({'param1':'something'})
param
>> {'param1': 'something'}

param.param1 = 'something else'
param
>> {'param1': 'something else'}

param.param1
>> 'something else'

However, if a NTParameterSet object is generated by unpickling it, modifying it is not possible:

import pickle
param_unpickled = pickle.loads(pickle.dumps(param))
param_unpickled
>> {'param1': 'something else'}

param_unpickled.param1 = 'a third thing'
param_unpickled # modification appears to be successful
>> {'param1': 'a third thing'}

param_unpickled.param1 # but directly accessing the value returns the old value
>> 'something else'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions