Skip to content

Commit

Permalink
Parameters: exclude more types from copying (#2134)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmantel authored Oct 2, 2021
1 parent e20a163 commit e938d45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions psyneulink/core/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,7 @@ def _initialize_parameters(self, context=None, **param_defaults):
Composition_Base,
ComponentsMeta,
types.MethodType,
types.ModuleType,
functools.partial,
)
alias_names = {p.name for p in self.class_parameters if isinstance(p, ParameterAlias)}
Expand Down
6 changes: 3 additions & 3 deletions psyneulink/core/globals/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def copy_parameter_value(value, shared_types=None, memo=None):
from psyneulink.core.components.component import Component, ComponentsMeta

if shared_types is None:
shared_types = (Component, ComponentsMeta, types.MethodType)
shared_types = (Component, ComponentsMeta, types.MethodType, types.ModuleType)
else:
shared_types = tuple(shared_types)

Expand Down Expand Up @@ -1520,7 +1520,7 @@ def clear_history(
pass

def _initialize_from_context(self, context=None, base_context=Context(execution_id=None), override=True):
from psyneulink.core.components.component import Component
from psyneulink.core.components.component import Component, ComponentsMeta

try:
try:
Expand All @@ -1539,7 +1539,7 @@ def _initialize_from_context(self, context=None, base_context=Context(execution_
except KeyError:
new_history = NotImplemented

shared_types = (Component, types.MethodType)
shared_types = (Component, ComponentsMeta, types.MethodType, types.ModuleType)

if isinstance(new_val, (dict, list)):
new_val = copy_iterable_with_shared(new_val, shared_types)
Expand Down

0 comments on commit e938d45

Please sign in to comment.