Skip to content

Changed the finalizer function for __type_dict#217

Merged
seventil merged 1 commit intodevelopfrom
type_dict_finalizer_fix
Feb 18, 2026
Merged

Changed the finalizer function for __type_dict#217
seventil merged 1 commit intodevelopfrom
type_dict_finalizer_fix

Conversation

@seventil
Copy link

This is a temporary quickfix, until __type_dict is pruned from the codebase. The need for this change is due to serialization of baseobjects creating temprorary objects. When the temp objects are finally GC'd, their name in the _store dict might be already taken by an actual (not a temporary) Parameter. GC then calls the the __type_dict's finalizer. In the old solution it was the prune method, which removes the key from __type_dict as well as _store (which might be an actual Parameter by that time). The new solution provides a method to delete keys only from the __type_dict, since removing keys from _store might affect actual Parameters and since _store is a weakref dict anyway.

This is a temporary quickfix, until __type_dict is pruned from the codebase. The need for this change is due to serialization of baseobjects creating temprorary objects. When the temp objects are finally GC'd, their name in the _store dict might be already taken by an actual (not a temporary) Parameter. GC then calls the the __type_dict's finalizer. In the old solution it was the prune method, which removes the key from __type_dict as well as _store (which might be an actual Parameter by that time). The new solution provides a method to delete keys only from the __type_dict, since removing keys from _store might affect actual Parameters and since _store is a weakref dict anyway.
@seventil seventil requested a review from damskii9992 February 18, 2026 15:26
@seventil seventil self-assigned this Feb 18, 2026
@seventil seventil added [scope] bug Bug report or fix (major.minor.PATCH) [area] global_object Anything related to the global_object [priority] high Should be prioritized soon labels Feb 18, 2026
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.13%. Comparing base (ed35c99) to head (667a09b).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #217      +/-   ##
===========================================
+ Coverage    81.11%   81.13%   +0.01%     
===========================================
  Files           52       52              
  Lines         4274     4277       +3     
  Branches       740      741       +1     
===========================================
+ Hits          3467     3470       +3     
  Misses         627      627              
  Partials       180      180              
Flag Coverage Δ
unittests 81.13% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/easyscience/global_object/map.py 95.23% <100.00%> (+0.06%) ⬆️

Copy link
Contributor

@damskii9992 damskii9992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, lets get this fucker merged!

@seventil seventil merged commit b87d591 into develop Feb 18, 2026
37 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[area] global_object Anything related to the global_object [priority] high Should be prioritized soon [scope] bug Bug report or fix (major.minor.PATCH)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments