Skip to content

Commit

Permalink
Revert "Revert "Parameter: make port a weakref""
Browse files Browse the repository at this point in the history
This reverts commit cf2fb8e.
  • Loading branch information
kmantel committed Jan 26, 2024
1 parent 75a123e commit 4824c83
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion psyneulink/core/globals/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,6 @@ def __init__(
reference=reference,
dependencies=dependencies,
initializer=initializer,
port=port,
mdf_name=mdf_name,
specify_none=specify_none,
_inherited=_inherited,
Expand All @@ -1077,6 +1076,8 @@ def __init__(
self.__inherited = False
self._inherited = _inherited

self.port = port

def __repr__(self):
return '{0} :\n{1}'.format(super(types.SimpleNamespace, self).__repr__(), str(self))

Expand Down Expand Up @@ -1814,6 +1815,20 @@ def _set_spec(self, value):
value = self._parse(value)
super().__setattr__('spec', value)

@property
def port(self):
try:
return self._port()
except TypeError:
return self._port

@port.setter
def port(self, p):
if p is None:
self._port = None
else:
self._port = weakref.ref(p)


class _ParameterAliasMeta(type):
# these will not be taken from the source
Expand Down

0 comments on commit 4824c83

Please sign in to comment.