Skip to content

Commit

Permalink
composition: Create a copy of 'controller_condition'
Browse files Browse the repository at this point in the history
If the controller_condition is not set by the caller it will be
a global instance of the "Always" condition. Adding a reference
there results in a leak.
Creating a copy for use in controller_condition avoids adding
a reference to a global instance.

Signed-off-by: Jan Vesely <[email protected]>

Revert "composition: Do not the store owner of 'controller_condition'"

This reverts commit a9194e8.
  • Loading branch information
jvesely committed May 21, 2024
1 parent 932d0fd commit b01e793
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion psyneulink/core/compositions/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -4097,7 +4097,7 @@ def __init__(
self.add_controller(controller)
self.controller_mode = controller_mode
self.controller_time_scale = controller_time_scale
self.controller_condition = controller_condition
self.controller_condition = copy(controller_condition)
self.controller_condition.owner = self.controller
# This is set at runtime and may be used by the controller to assign its
# `num_trials_per_estimate <OptimizationControlMechanism.num_trials_per_estimate>` attribute.
Expand Down

0 comments on commit b01e793

Please sign in to comment.