Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
abast opened this issue Apr 18, 2019 · 0 comments
Open

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

abast opened this issue Apr 18, 2019 · 0 comments

Comments

@abast
Copy link

abast commented Apr 18, 2019

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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant