Commit b14154b6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3c1c9f41
// XXX dup from neo/go/zodb/internal/pickletools
package pycompat
import (
"math/big"
)
// Int64 tries to convert unpickled Python value to int64.
//
// (ogórek decodes python long as big.Int)
//
// XXX + support for float?
func Int64(xv interface{}) (v int64, ok bool) {
switch v := xv.(type) {
case int64:
return v, true
case *big.Int:
if v.IsInt64() {
return v.Int64(), true
}
}
return 0, false
}
...@@ -34,6 +34,8 @@ import ( ...@@ -34,6 +34,8 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb" "lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree" "lab.nexedi.com/kirr/neo/go/zodb/btree"
pickle "github.com/kisielk/og-rek" pickle "github.com/kisielk/og-rek"
"./internal/pycompat"
) )
// module of Wendelin ZODB py objects // module of Wendelin ZODB py objects
...@@ -319,7 +321,7 @@ func (bf *zBigFileState) PySetState(pystate interface{}) (err error) { ...@@ -319,7 +321,7 @@ func (bf *zBigFileState) PySetState(pystate interface{}) (err error) {
return fmt.Errorf("expect [2](); got [%d]()", len(t)) return fmt.Errorf("expect [2](); got [%d]()", len(t))
} }
blksize, ok := zodbpickle.Xint64(t[0]) // XXX reenable (pickletools) blksize, ok := pycompat.Int64(t[0])
if !ok { if !ok {
return fmt.Errorf("blksize: expect integer; got %T", t[0]) return fmt.Errorf("blksize: expect integer; got %T", t[0])
} }
......
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