[PATCH] Fix spdxcheck.py.
From: Andreas Wendleder
Date: Tue Apr 08 2025 - 05:21:17 EST
As explained in Ricardo Ribalda's patch:
If the git.Repo object's scope extends to the Python interpreter's
shutdown phase, its destructor may fail due to the interpreter's state.
Exception ignored in: <function Git.AutoInterrupt.__del__ at 0x76e6b0148040>
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/git/cmd.py", line 790, in __del__
File "/usr/lib/python3.13/site-packages/git/cmd.py", line 781, in _terminate
File "/usr/lib/python3.13/subprocess.py", line 2227, in terminate
ImportError: sys.meta_path is None, Python is likely shutting down
Unfortunately, repo is used later at line 392 and 399, so we have to
keep it and manually delete it before exiting. This can be checked by
testing a directory instead of a file.
Signed-off--by: Andreas Wendleder <gonsolo@xxxxxxxxx>
---
scripts/spdxcheck.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 8d608f61bf37..6a89e2b2faba 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -448,6 +448,7 @@ if __name__ == '__main__':
for f in sorted(di.files):
sys.stderr.write(' %s\n' %f)
+ del repo
sys.exit(0)
except Exception as ex:
--
2.49.0