We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 119982a commit b22933cCopy full SHA for b22933c
object.go
@@ -15,6 +15,7 @@ import (
15
// the Python Object's DecRef method during garbage collection.
16
type pyObject struct {
17
obj *C.PyObject
18
+ g *globalData
19
}
20
21
func (obj *pyObject) Obj() *PyObject {
@@ -54,9 +55,9 @@ func newObject(obj *PyObject) Object {
54
55
C.PyErr_Print()
56
panic("nil Python object")
57
- o := &pyObject{obj: obj}
58
+ o := &pyObject{obj: obj, g: getGlobalData()}
59
runtime.SetFinalizer(o, func(o *pyObject) {
- getGlobalData().addDecRef(o.obj)
60
+ o.g.addDecRef(o.obj)
61
runtime.SetFinalizer(o, nil)
62
})
63
return Object{o}
0 commit comments