We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fd4658b commit 8988fe4Copy full SHA for 8988fe4
src/python.ts
@@ -3,6 +3,8 @@
3
import { py } from "./ffi.ts";
4
import { cstr, SliceItemRegExp } from "./util.ts";
5
6
+const refregistry = new FinalizationRegistry(py.Py_DecRef);
7
+
8
/**
9
* Symbol used on proxied Python objects to point to the original PyObject object.
10
* Can be used to implement PythonProxy and create your own proxies.
@@ -202,6 +204,7 @@ export class PyObject {
202
204
*/
203
205
get owned(): PyObject {
206
py.Py_IncRef(this.handle);
207
+ refregistry.register(this, this.handle);
208
return this;
209
}
210
0 commit comments