-
-
Notifications
You must be signed in to change notification settings - Fork 932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AutoInterrupt is broken with Python 3.12.9 #2003
Comments
Python-side fixes will be in the next 3.12 and 3.13 patch releases. What gitpython can do to work around it is something along the lines of this workaround within import signal # top of the git/cmd.py file.
...
def __del__(self): # Git.AutoInterrupt.__del__
...
try:
self.$PROC.terminate()
except ImportError:
# workaround for https://github.com/python/cpython/issues/118761#issuecomment-2661504264 in 3.12.9 and 3.13.2
self.$PROC.send_signal(signal.SIGTERM)
... |
That's somewhat awkward, you could just always |
That workaround is POSIX platform specific, |
Thanks a lot for reporting and sketching out a possible workaround. |
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,
The text was updated successfully, but these errors were encountered: