Skip to content

Commit

Permalink
Parameter: correct .set post-initialization check (#3116)
Browse files Browse the repository at this point in the history
Parameter.set checks for Component values assigned after
its owning Component's __init__ so that the assigned Components
can be shaped compatibly and set up for later context initialization.

Check for ContextFlags.INITIALIZED initialization_status instead of
is_initialized, because is_initialized also considers any initialization
context, not just the status of having completed Component.__init__
  • Loading branch information
kmantel authored Nov 14, 2024
1 parent 59c9736 commit 3fc73e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion psyneulink/core/globals/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ def set(self, value, context=None, override=False, skip_history=False, skip_log=
if isinstance(value, Component):
owner = self._owner._owner
if value not in owner._parameter_components:
if not owner.is_initializing:
if owner.initialization_status == ContextFlags.INITIALIZED:
value._initialize_from_context(context)
owner._parameter_components.add(value)

Expand Down

0 comments on commit 3fc73e1

Please sign in to comment.