Commit e0e8d81
committed
refactor(robot): replace __del__ with weakref.finalize in imports_manager
Replace fragile `__del__` methods with `weakref.finalize` in both
`_ImportEntry` and `ImportsManager` for reliable cleanup:
- _ImportEntry: register finalizer in __init__ with file_watchers list
and file_watcher_manager as strong refs (no self access needed);
change _remove_file_watcher to use .clear() instead of = []
- ImportsManager: register finalizer lazily in executor property when
ProcessPoolExecutor is created; add static _shutdown_executor callback
weakref.finalize is guaranteed to run even with circular references
and does not prevent garbage collection of reference cycles.1 parent 7b3999e commit e0e8d81
File tree
1 file changed
+22
-9
lines changed- packages/robot/src/robotcode/robot/diagnostics
1 file changed
+22
-9
lines changedLines changed: 22 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
115 | 121 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
121 | 133 | | |
122 | 134 | | |
123 | 135 | | |
124 | 136 | | |
125 | 137 | | |
126 | | - | |
| 138 | + | |
127 | 139 | | |
128 | 140 | | |
129 | 141 | | |
| |||
644 | 656 | | |
645 | 657 | | |
646 | 658 | | |
647 | | - | |
| 659 | + | |
| 660 | + | |
648 | 661 | | |
649 | | - | |
650 | | - | |
| 662 | + | |
651 | 663 | | |
652 | 664 | | |
653 | 665 | | |
| |||
1250 | 1262 | | |
1251 | 1263 | | |
1252 | 1264 | | |
| 1265 | + | |
1253 | 1266 | | |
1254 | 1267 | | |
1255 | 1268 | | |
| |||
0 commit comments