File tree 2 files changed +7
-1
lines changed
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ Unreleased
6
6
- Drop support for Python 3.8. :pr: `175 `
7
7
- Remove previously deprecated ``__version__ ``, ``receiver_connected ``,
8
8
``Signal.temporarily_connected_to `` and ``WeakNamespace ``. :pr: `172 `
9
+ - Skip weakref signal cleanup if the interpreter is shutting down.
10
+ :issue: `173 `
9
11
10
12
11
13
Version 1.8.2
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import collections .abc as c
4
+ import sys
4
5
import typing as t
5
6
import weakref
6
7
from collections import defaultdict
@@ -403,7 +404,10 @@ def _make_cleanup_receiver(
403
404
"""
404
405
405
406
def cleanup (ref : weakref .ref [c .Callable [..., t .Any ]]) -> None :
406
- self ._disconnect (receiver_id , ANY_ID )
407
+ # If the interpreter is shutting down, disconnecting can result in a
408
+ # weird ignored exception. Don't call it in that case.
409
+ if not sys .is_finalizing ():
410
+ self ._disconnect (receiver_id , ANY_ID )
407
411
408
412
return cleanup
409
413
You can’t perform that action at this time.
0 commit comments