mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-01 15:07:49 +00:00
Merge pull request #6345 from prahal/fix-python-regression-master
Python3: Add patch to fix crash in sqlite3 import
This commit is contained in:
commit
62d1642ba3
@ -0,0 +1,57 @@
|
|||||||
|
From e5d8e72824a34c78552bec74511cb8e5412746c2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alban Browaeys <alban.browaeys@gmail.com>
|
||||||
|
Date: Thu, 24 Mar 2022 22:20:41 +0100
|
||||||
|
Subject: [PATCH] Revert "bpo-46070: _PyGC_Fini() untracks objects (GH-30577)
|
||||||
|
(GH-30580)"
|
||||||
|
|
||||||
|
This reverts commit 52937c26adc35350ca0402070160cf6dc838f359.
|
||||||
|
The above commit segfaults python 3.9.11 if importing sqlite3 in
|
||||||
|
threads.
|
||||||
|
---
|
||||||
|
Modules/gcmodule.c | 24 ------------------------
|
||||||
|
1 file changed, 24 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
|
||||||
|
index 3cf1a00b00..2c6ef9252e 100644
|
||||||
|
--- a/Modules/gcmodule.c
|
||||||
|
+++ b/Modules/gcmodule.c
|
||||||
|
@@ -2149,36 +2149,12 @@ _PyGC_DumpShutdownStats(PyThreadState *tstate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
-static void
|
||||||
|
-gc_fini_untrack(PyGC_Head *list)
|
||||||
|
-{
|
||||||
|
- PyGC_Head *gc;
|
||||||
|
- for (gc = GC_NEXT(list); gc != list; gc = GC_NEXT(list)) {
|
||||||
|
- PyObject *op = FROM_GC(gc);
|
||||||
|
- _PyObject_GC_UNTRACK(op);
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
void
|
||||||
|
_PyGC_Fini(PyThreadState *tstate)
|
||||||
|
{
|
||||||
|
GCState *gcstate = &tstate->interp->gc;
|
||||||
|
Py_CLEAR(gcstate->garbage);
|
||||||
|
Py_CLEAR(gcstate->callbacks);
|
||||||
|
-
|
||||||
|
- if (!_Py_IsMainInterpreter(tstate)) {
|
||||||
|
- // bpo-46070: Explicitly untrack all objects currently tracked by the
|
||||||
|
- // GC. Otherwise, if an object is used later by another interpreter,
|
||||||
|
- // calling PyObject_GC_UnTrack() on the object crashs if the previous
|
||||||
|
- // or the next object of the PyGC_Head structure became a dangling
|
||||||
|
- // pointer.
|
||||||
|
- for (int i = 0; i < NUM_GENERATIONS; i++) {
|
||||||
|
- PyGC_Head *gen = GEN_HEAD(gcstate, i);
|
||||||
|
- gc_fini_untrack(gen);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for debugging */
|
||||||
|
--
|
||||||
|
2.30.2
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user