Commit c10c7e9
authored
Re-apply GH-154858, which was reverted in GH-154992 because it broke the
reference leak buildbots.
``atexit.register(_clear_caches)`` runs on every import of ``typing``, and the
registered handler reaches the module dict through ``_clear_caches.__globals__``.
Any throwaway copy of ``typing`` therefore stays alive until interpreter
shutdown. Two tests create such a copy on each iteration:
- ``InternalsTests.test_collect_parameters`` imports a fresh ``typing``.
- ``CollectionsAbcTests.test_bytestring`` drops ``typing`` from ``sys.modules``
and re-imports it.
Both now unregister the exit handler of the copy they created.
1 parent a4095ee commit c10c7e9
3 files changed
Lines changed: 23 additions & 0 deletions
File tree
- Lib
- test
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
6550 | 6551 | | |
6551 | 6552 | | |
6552 | 6553 | | |
| 6554 | + | |
| 6555 | + | |
| 6556 | + | |
| 6557 | + | |
| 6558 | + | |
| 6559 | + | |
| 6560 | + | |
| 6561 | + | |
6553 | 6562 | | |
6554 | 6563 | | |
6555 | 6564 | | |
| |||
7719 | 7728 | | |
7720 | 7729 | | |
7721 | 7730 | | |
| 7731 | + | |
| 7732 | + | |
| 7733 | + | |
| 7734 | + | |
7722 | 7735 | | |
7723 | 7736 | | |
7724 | 7737 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
397 | 398 | | |
398 | 399 | | |
399 | 400 | | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
400 | 406 | | |
401 | 407 | | |
402 | 408 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments