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 {
pyobj := &pyObject{
object: object{jar: conn, oid: oid, serial: 0},
pyclass: pyclass,
//instance: nil,
}
// switch on pyclass and transform e.g. "zodb.BTree.Bucket" -> *ZBucket
classNew := classTab[pyclass.Module + "." + pyclass.Name]
if classNew == nil {
return pyobj // XXX or return error here?
var instance PyObject
if classNew != nil {
instance = classNew(pyobj)
} else {
instance = &dummyPyInstance{pyObject: pyobj}
}
obj := classNew(pyobj)
pyobj.instance = obj
return obj
pyobj.instance = instance
return instance
}
// 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