Skip to content

Commit a970484

Browse files
committed
fix(bar): cooperatively chain __del__ to superclass finalizer
ProgressBarMixinBase.__del__ ran finish() but never chained to a super __del__ (CodeQL 'missing call to superclass __del__', re-surfaced after the ProgressBarBase base-class change). Add a hasattr-guarded super().__del__() call: a no-op today (abc.ABC/object define no __del__) but keeps finalization cooperative and avoids an AttributeError if a base with __del__ is ever added.
1 parent c5ead2f commit a970484

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

progressbar/bar.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ def __del__(self):
175175
except Exception: # noqa: BLE001, S110
176176
pass
177177

178+
# Cooperatively chain to a superclass finalizer when one exists. This
179+
# class's bases (abc.ABC, object) define no __del__, so the call is a
180+
# no-op today; the guard keeps finalization cooperative — and avoids
181+
# an AttributeError — should a base with __del__ ever be introduced.
182+
if hasattr(super(), '__del__'): # pragma: no cover
183+
super().__del__() # pyright: ignore[reportAttributeAccessIssue]
184+
178185
def __getstate__(self):
179186
return self.__dict__
180187

0 commit comments

Comments
 (0)