From e938d45f1e07a385b999df046e81092b06a35335 Mon Sep 17 00:00:00 2001 From: Katherine Mantel Date: Sat, 2 Oct 2021 03:27:24 -0400 Subject: [PATCH] Parameters: exclude more types from copying (#2134) --- psyneulink/core/components/component.py | 1 + psyneulink/core/globals/parameters.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/psyneulink/core/components/component.py b/psyneulink/core/components/component.py index e20eb513d64..32b903cf57a 100644 --- a/psyneulink/core/components/component.py +++ b/psyneulink/core/components/component.py @@ -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)} diff --git a/psyneulink/core/globals/parameters.py b/psyneulink/core/globals/parameters.py index 5041e438304..9cd5d37a592 100644 --- a/psyneulink/core/globals/parameters.py +++ b/psyneulink/core/globals/parameters.py @@ -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) @@ -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: @@ -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)