Open
Description
Refer to the comment, CPython is refactoring stdlib modules with lazy import, improving performance on loading.
Unfortunately, this breaks the AutoInterrupt wrapper in GitPython, whose finalizer makes use of subprocess.Popen.terminate(). After the refactor of subprocess module1, the terminate() method may lazily load signal module, which is problematic if it is invoked during the interpreter finalization.
A real-world reproducer is the spdxcheck.py2 script in Linux kernel,
$ ./scripts/spdxcheck.py outgoing/clock/v3/v3-0001-dt-bindings-clock-Document-clock-and-reset-unit-o.patch
Exception ignored in: <function Git.AutoInterrupt.__del__ at 0x7f25d89cd260>
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/git/cmd.py", line 790, in __del__
File "/usr/lib/python3.12/site-packages/git/cmd.py", line 781, in _terminate
File "/usr/lib/python3.12/subprocess.py", line 2220, in terminate
ImportError: sys.meta_path is None, Python is likely shutting down