aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Modules/gcmodule.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-02-07 09:25:06 +0300
committershadchin <shadchin@yandex-team.com>2024-02-07 09:40:03 +0300
commit3139d9ab6df2a7014d19b87582466d17b4f496e2 (patch)
tree7fcb26a72dac212aa26beaaa7cd769fb1e396b5e /contrib/tools/python3/src/Modules/gcmodule.c
parent4c04a8d1e278e6ca7ff16c11b74b2f16fc144253 (diff)
downloadydb-3139d9ab6df2a7014d19b87582466d17b4f496e2.tar.gz
Update Python 3 to 3.11.8
Diffstat (limited to 'contrib/tools/python3/src/Modules/gcmodule.c')
-rw-r--r--contrib/tools/python3/src/Modules/gcmodule.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/tools/python3/src/Modules/gcmodule.c b/contrib/tools/python3/src/Modules/gcmodule.c
index 95f5085edb..ff0188da1d 100644
--- a/contrib/tools/python3/src/Modules/gcmodule.c
+++ b/contrib/tools/python3/src/Modules/gcmodule.c
@@ -2349,14 +2349,18 @@ PyObject_GC_Del(void *op)
size_t presize = _PyType_PreHeaderSize(((PyObject *)op)->ob_type);
PyGC_Head *g = AS_GC(op);
if (_PyObject_GC_IS_TRACKED(op)) {
+ gc_list_remove(g);
#ifdef Py_DEBUG
+ PyObject *exc, *exc_value, *exc_tb;
+ PyErr_Fetch(&exc, &exc_value, &exc_tb);
if (PyErr_WarnExplicitFormat(PyExc_ResourceWarning, "gc", 0,
"gc", NULL, "Object of type %s is not untracked before destruction",
((PyObject*)op)->ob_type->tp_name)) {
PyErr_WriteUnraisable(NULL);
}
+ if (exc != NULL)
+ PyErr_Restore(exc, exc_value, exc_tb);
#endif
- gc_list_remove(g);
}
GCState *gcstate = get_gc_state();
if (gcstate->generations[0].count > 0) {