Commit 9605b703 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a65f9492
...@@ -359,20 +359,35 @@ func (conn *Connection) newGhost(pyclass pickle.Class, oid zodb.Oid) PyObject { ...@@ -359,20 +359,35 @@ func (conn *Connection) newGhost(pyclass pickle.Class, oid zodb.Oid) PyObject {
pyobj := &pyObject{ pyobj := &pyObject{
object: object{jar: conn, oid: oid, serial: 0}, object: object{jar: conn, oid: oid, serial: 0},
pyclass: pyclass, pyclass: pyclass,
//instance: nil,
} }
// switch on pyclass and transform e.g. "zodb.BTree.Bucket" -> *ZBucket // switch on pyclass and transform e.g. "zodb.BTree.Bucket" -> *ZBucket
classNew := classTab[pyclass.Module + "." + pyclass.Name] classNew := classTab[pyclass.Module + "." + pyclass.Name]
if classNew == nil { var instance PyObject
return pyobj // XXX or return error here? if classNew != nil {
instance = classNew(pyobj)
} else {
instance = &dummyPyInstance{pyObject: pyobj}
} }
obj := classNew(pyobj) pyobj.instance = instance
pyobj.instance = obj return instance
return obj }
// dummyPyInstance is used for python classes that were not registered.
type dummyPyInstance struct {
*pyObject
pystate interface{}
} }
func (d *dummyPyInstance) DropState() {
d.pystate = nil
}
func (d *dummyPyInstance) PySetState(pystate interface{}) error {
d.pystate = pystate
return nil
}
// ---------------------------------------- // ----------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment