From edc0f87e25b6ce91e19271d43cb563f387ada11a Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 7 Oct 2021 10:41:24 -0700 Subject: [PATCH] FIX Don't destroy attribute proxies if root proxy is leaked and GC'd (#1870) --- docs/project/changelog.md | 5 +++++ src/core/pyproxy.js | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/project/changelog.md b/docs/project/changelog.md index 3ae7b6312..7ddb3eb04 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -36,6 +36,11 @@ substitutions: `PyProxy` (as introduced by {pr}`1636`) before destroying the root `PyProxy`. {pr}`1854` +- {{Fix}} Borrowed attribute `PyProxy`s are no longer destroyed when the root + `PyProxy` is garbage collected (because it was leaked). Doing so has no + benefit to nonleaky code and turns some leaky code into broken code (see + {issue}`1855` for an example). {pr}`1870` + ### pyodide-build - {{API}} By default only a minimal set of packages is built. To build all diff --git a/src/core/pyproxy.js b/src/core/pyproxy.js index 950181818..f43d6e9b7 100644 --- a/src/core/pyproxy.js +++ b/src/core/pyproxy.js @@ -31,7 +31,6 @@ Module.isPyProxy = isPyProxy; if (globalThis.FinalizationRegistry) { Module.finalizationRegistry = new FinalizationRegistry(([ptr, cache]) => { - pyproxy_decref_cache(cache); try { Module._Py_DecRef(ptr); } catch (e) {