Commit 0b5852c
committed
Fix crash when a destructor uses lazy imports during shutdown
Destructors can run after finalization has cleared the interpreter's
lazy_modules set and lazy_pending_submodules dict. Declaring or
resolving a lazy import from one of them passed NULL to PySet_Add(),
PySet_Discard() or the pending-submodules lookup.
Treat the bookkeeping as a no-op once the state is gone, as the other
readers of this state already do.1 parent 587b7a5 commit 0b5852c
2 files changed
Lines changed: 53 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2807 | 2807 | | |
2808 | 2808 | | |
2809 | 2809 | | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
2810 | 2850 | | |
2811 | 2851 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
| |||
4179 | 4183 | | |
4180 | 4184 | | |
4181 | 4185 | | |
4182 | | - | |
| 4186 | + | |
| 4187 | + | |
| 4188 | + | |
| 4189 | + | |
4183 | 4190 | | |
4184 | 4191 | | |
4185 | 4192 | | |
| |||
4213 | 4220 | | |
4214 | 4221 | | |
4215 | 4222 | | |
4216 | | - | |
| 4223 | + | |
| 4224 | + | |
| 4225 | + | |
| 4226 | + | |
4217 | 4227 | | |
4218 | 4228 | | |
4219 | 4229 | | |
| |||
5575 | 5585 | | |
5576 | 5586 | | |
5577 | 5587 | | |
5578 | | - | |
| 5588 | + | |
5579 | 5589 | | |
5580 | 5590 | | |
5581 | 5591 | | |
| |||
0 commit comments