-
Notifications
You must be signed in to change notification settings - Fork 174
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
Copying a SPA model fails #1266
Milestone
Comments
jgosmann
added a commit
that referenced
this issue
Feb 15, 2017
The keys of the WeakKeyIDDictionaries do not get updated on a normal copy operation. This is rarely a problem because Parameters are usually class variables that will not get copied, but there is the possibility to define instance parameters (slightly obscure usage, but is for example used in the current SPA system). In this case the Parameter instance needs to be copied. Adding the __getstate__ and __setstate__ handler allows to convert the WeakKeyIDDictionaries to normal dictionaries with strong references and convert them back. This will cause the keys to be updated (partially due to Pythons copy magic). It also seems to me that obtaining strong references during the copy process is a good idea because than none of the objects can disappear during copying (or serialization). Addresses #1266.
jgosmann
added a commit
that referenced
this issue
Feb 15, 2017
The involved __getattr__/__setattr__ logic would otherwise screw up. Addresses #1266.
jgosmann
added a commit
that referenced
this issue
Feb 15, 2017
When reconstructing objects during copy, the check for whether a module has been added twice to a model needs to be avoided. Addresses #1266.
tbekolay
pushed a commit
that referenced
this issue
Feb 17, 2017
The keys of the WeakKeyIDDictionaries do not get updated on a normal copy operation. This is rarely a problem because Parameters are usually class variables that will not get copied, but there is the possibility to define instance parameters (slightly obscure usage, but is for example used in the current SPA system). In this case the Parameter instance needs to be copied. Adding the __getstate__ and __setstate__ handler allows to convert the WeakKeyIDDictionaries to normal dictionaries with strong references and convert them back. This will cause the keys to be updated (partially due to Python's copy magic). It also seems to me that obtaining strong references during the copy process is a good idea because than none of the objects can disappear during copying (or serialization). Addresses #1266.
tbekolay
pushed a commit
that referenced
this issue
Feb 17, 2017
The involved __getattr__/__setattr__ logic would otherwise screw up. Addresses #1266.
tbekolay
pushed a commit
that referenced
this issue
Feb 17, 2017
When reconstructing objects during copy, the check for whether a module has been added twice to a model needs to be avoided. Addresses #1266.
3 tasks
adityagilra
pushed a commit
to adityagilra/nengo
that referenced
this issue
Jun 21, 2017
The keys of the WeakKeyIDDictionaries do not get updated on a normal copy operation. This is rarely a problem because Parameters are usually class variables that will not get copied, but there is the possibility to define instance parameters (slightly obscure usage, but is for example used in the current SPA system). In this case the Parameter instance needs to be copied. Adding the __getstate__ and __setstate__ handler allows to convert the WeakKeyIDDictionaries to normal dictionaries with strong references and convert them back. This will cause the keys to be updated (partially due to Python's copy magic). It also seems to me that obtaining strong references during the copy process is a good idea because than none of the objects can disappear during copying (or serialization). Addresses nengo#1266.
adityagilra
pushed a commit
to adityagilra/nengo
that referenced
this issue
Jun 21, 2017
The involved __getattr__/__setattr__ logic would otherwise screw up. Addresses nengo#1266.
adityagilra
pushed a commit
to adityagilra/nengo
that referenced
this issue
Jun 21, 2017
When reconstructing objects during copy, the check for whether a module has been added twice to a model needs to be avoided. Addresses nengo#1266.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any model with nengo.spa doesn't seem to be able to be copied:
The text was updated successfully, but these errors were encountered: