Skip to content

AutoInterrupt is broken with Python 3.12.9 #2003

Open
@ziyao233

Description

@ziyao233

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy