[pybsddb] Change in pickle behavior since Py3rc1 breaks dbshelve.get

Jesus Cea jcea at argo.es
Tue Sep 23 23:47:27 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dmitry Dvoinikov wrote:
> It looks like pickle module behaves differently in Py3rc1 with
> respect to deserializing None:
> 
> in Py2x:
> import cPickle
> cPickle.loads(None) => throws TypeError
> 
> in Py3rc1:
> import pickle
> pickle.loads(None) => throws EOFError
> 
> I have no idea whether this change is intentional, but it does
> break dbshelve.get, because lines 233-237 no longer work:

Dmitry, this change is already done in 4.7.3pre9:

"""
        data = apply(self.db.get, args, kw)
        try:
            return cPickle.loads(data)
        except (EOFError, TypeError, cPickle.UnpicklingError):
            return data  # we may be getting the default value, or None,
                         # so it doesn't need unpickled.

"""

pybsddb 4.7.3 will be published next week, just after Python 2.6 release.

pybsddb 4.7.3 will work in Python 3.0, natively. But the API is subject
to change, specially the unicode<->byte management. The API will be
improved in future releases. Since I'm publishing a new version per
month, you'd better provide suggestion here to improve the API, instead
of coding workarounds in your applications.

- --
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea at jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:jcea at jabber.org         _/_/    _/_/          _/_/_/_/_/
.                              _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBSNlj55lgi5GaxT1NAQKdxAP+PyzVe9xaDWz0Ga+3q60S7w97s2Wvf6J6
VdI0uSdFpxgoC8q9YrQP7njx18w/lOCY679yNLJNfVmGS6NBbIE0yYoPWHY0b1EB
rATedI9K17gpFc9h0jp4aBTbdzIWzHplwZSRhxgS4tFxM6kJC8sFXQSFBxAcHWOE
4+8k57Hxu1I=
=DLk9
-----END PGP SIGNATURE-----



More information about the pybsddb mailing list