{{ message }}
fix: guard AutoInterrupt terminate during interpreter shutdown#2105
Merged
EliahKagan merged 2 commits intoMar 9, 2026
Merged
Conversation
Byron
approved these changes
Feb 26, 2026
dae9b25 to
357aad1
Compare
March 9, 2026 17:56
EliahKagan
approved these changes
Mar 9, 2026
EliahKagan
left a comment
Member
There was a problem hiding this comment.
I've made two changes:
- Rebased this onto main after merging #2108 to fix #2107 (which arose more recently than #2105 (review) and is not due to changes here, but would have appeared here next time CI ran).
- Fixed the blocker mentioned in #2105 (review) where the lint job failed. This was due to an unnecessary
import pytest(since the module does not use anything from thepytestmodule in its own code).
I plan to merge this once CI passes.
Sorry, something went wrong.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Windows interpreter-shutdown edge case where Git.AutoInterrupt._terminate() can raise AttributeError from subprocess.Popen.terminate() due to partially torn-down stdlib internals, preventing noisy “Exception ignored in: del” messages.
Changes:
- Treat
AttributeErrorfromproc.terminate()similarly to existingOSErrorhandling in_AutoInterrupt._terminate(). - Add a regression test that simulates
terminate()raisingAttributeErrorand asserts_terminate()does not raise and clearsproc.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
git/cmd.py |
Extends _AutoInterrupt._terminate() exception handling to include AttributeError during termination. |
test/test_autointerrupt.py |
Adds a focused regression test for AttributeError raised from terminate(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Sorry, something went wrong.
Hide details
View details
EliahKagan
merged commit
e23c548
into
gitpython-developers:main
Mar 9, 2026
31 checks passed
736-c41-2c1-e464fc974
pushed a commit
to Swiss-Armed-Forces/Loom
that referenced
this pull request
Apr 27, 2026
This MR contains the following updates: | Package | Type | Update | Change | OpenSSF | |---|---|---|---|---| | [gitpython](https://github.com/gitpython-developers/GitPython) | dev | patch | `3.1.46` → `3.1.47` | [](https://securityscorecards.dev/viewer/?uri=github.com/gitpython-developers/GitPython) | --- ### Release Notes <details> <summary>gitpython-developers/GitPython (gitpython)</summary> ### [`v3.1.47`](https://github.com/gitpython-developers/GitPython/releases/tag/3.1.47): - with security fixes [Compare Source](gitpython-developers/GitPython@3.1.46...3.1.47) #### Advisories - <GHSA-rpm5-65cw-6hj4> - <GHSA-x2qx-6953-8485> #### What's Changed - Prepare next release by [@​Byron](https://github.com/Byron) in [#​2095](gitpython-developers/GitPython#2095) - Bump git/ext/gitdb from `335c0f6` to `4c63ee6` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2096](gitpython-developers/GitPython#2096) - DOC: README Add urls and updated a relative url by [@​Timour-Ilyas](https://github.com/Timour-Ilyas) in [#​2098](gitpython-developers/GitPython#2098) - Fix GitConfigParser ignoring multiple \[include] path entries by [@​daniel7an](https://github.com/daniel7an) in [#​2100](gitpython-developers/GitPython#2100) - Switch back from Alpine to Debian for WSL by [@​EliahKagan](https://github.com/EliahKagan) in [#​2108](gitpython-developers/GitPython#2108) - Bump git/ext/gitdb from `4c63ee6` to `5c1b303` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2106](gitpython-developers/GitPython#2106) - Run `gc.collect()` twice in `test_rename` on Python 3.12 by [@​EliahKagan](https://github.com/EliahKagan) in [#​2109](gitpython-developers/GitPython#2109) - fix: guard AutoInterrupt terminate during interpreter shutdown by [@​lweyrich1](https://github.com/lweyrich1) in [#​2105](gitpython-developers/GitPython#2105) - Improve CI infrastructure for pre-commit by [@​EliahKagan](https://github.com/EliahKagan) in [#​2110](gitpython-developers/GitPython#2110) - Bump the pre-commit group with 5 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2111](gitpython-developers/GitPython#2111) - Upgrade Sphinx for 3.14 support; drop doc build support on 3.8; test 3.14 by [@​EliahKagan](https://github.com/EliahKagan) in [#​2112](gitpython-developers/GitPython#2112) - Fix `Repo.active_branch` resolution for reftable-backed repositories by [@​Copilot](https://github.com/Copilot) in [#​2114](gitpython-developers/GitPython#2114) - docs: warn about GitDB performance with large commits by [@​mvanhorn](https://github.com/mvanhorn) in [#​2115](gitpython-developers/GitPython#2115) - cmd: fix kwarg formatting in docstring example by [@​UweSchwaeke](https://github.com/UweSchwaeke) in [#​2117](gitpython-developers/GitPython#2117) - Bump <https://github.com/astral-sh/ruff-pre-commit> from v0.15.5 to 0.15.8 in the pre-commit group by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2122](gitpython-developers/GitPython#2122) - Add trailer support for commit creation by [@​Krishnachaitanyakc](https://github.com/Krishnachaitanyakc) in [#​2116](gitpython-developers/GitPython#2116) - Harden commit trailer subprocess handling and align trailer I/O paths by [@​Copilot](https://github.com/Copilot) in [#​2125](gitpython-developers/GitPython#2125) - git.cmd.Git.execute(..): fix `with_stdout=False` by [@​ngie-eign](https://github.com/ngie-eign) in [#​2126](gitpython-developers/GitPython#2126) - Make sure that multi-options are checked after splitting them with `shlex` by [@​Byron](https://github.com/Byron) in [#​2130](gitpython-developers/GitPython#2130) - Block unsafe underscored git kwargs / Fix for GHSA-rpm5-65cw-6hj4 by [@​WesR](https://github.com/WesR) in [#​2131](gitpython-developers/GitPython#2131) #### New Contributors - [@​Timour-Ilyas](https://github.com/Timour-Ilyas) made their first contribution in [#​2098](gitpython-developers/GitPython#2098) - [@​daniel7an](https://github.com/daniel7an) made their first contribution in [#​2100](gitpython-developers/GitPython#2100) - [@​lweyrich1](https://github.com/lweyrich1) made their first contribution in [#​2105](gitpython-developers/GitPython#2105) - [@​Copilot](https://github.com/Copilot) made their first contribution in [#​2114](gitpython-developers/GitPython#2114) - [@​mvanhorn](https://github.com/mvanhorn) made their first contribution in [#​2115](gitpython-developers/GitPython#2115) - [@​UweSchwaeke](https://github.com/UweSchwaeke) made their first contribution in [#​2117](gitpython-developers/GitPython#2117) - [@​Krishnachaitanyakc](https://github.com/Krishnachaitanyakc) made their first contribution in [#​2116](gitpython-developers/GitPython#2116) - [@​ngie-eign](https://github.com/ngie-eign) made their first contribution in [#​2126](gitpython-developers/GitPython#2126) - [@​WesR](https://github.com/WesR) made their first contribution in [#​2131](gitpython-developers/GitPython#2131) **Full Changelog**: <gitpython-developers/GitPython@3.1.46...3.1.47> </details> --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNDEuNSIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> See merge request swiss-armed-forces/cyber-command/cea/loom!486 Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.
Fixes #2102
On Windows during interpreter shutdown, process objects can be partially torn down and
terminate()may raiseAttributeError(e.g. missingTerminateProcess).This PR treats that similarly to the existing
OSErrorhandling in_AutoInterrupt._terminate()and adds a regression test covering theAttributeErrorcase.Tests:
pytest -q test/test_autointerrupt.py