Re: Re: Python-3-Migration of existing Data.fs
Jim Fulton <[email protected]> Sun, 25 Mar 2018 13:40:44 -0600
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <CAPDm-Fhg=snD3wu89tC5DrMtoFHgibHvQ7r3fLjF3t1b9pxdWw@mail.gmail.com> |
On Tue, Mar 20, 2018 at 11:04 AM, Arthur LEDARD <[email protected]> wrote: > There it is : https://github.com/vert-rouge/sample-zodb-migration-2to3 > comments are in French, sorry about that. > > I would like to add that if you make a subtle change in ZODB._compat.py, > my problem is solved. > > around line 50 > class Unpickler(zodbpickle.pickle.Unpickler): > def __init__(self, f): > - super(Unpickler, self).__init__(f) > + super(Unpickler, self).__init__(f, errors="bytes") > I'm glad you have a workaround. :) I don't like this as a general solution. In fact, I'm not even sure it's a proper local solution, as it seems to cause some oids to be deserialized as bytes and some as unicode, although I bet something in the stack converts back to bytes when a unicode oid is encountered, > > > It’s done for loads around line 70 > def loads(s): > return zodbpickle.pickle.loads(s, encoding='ASCII', errors='bytes') > That makes me uncomfortable for the same reason. The problem is that we don't save oids as binary in persistent ids. This is fairly easy to fix. A related problem is that we don't use protocol 3 under Python 2, which largely defeats zodbpickle.binary, because it causes binary data to be treated as latin-1-encoded unicode. :( Jim -- Jim Fulton http://jimfulton.info -- You received this message because you are subscribed to the Google Groups "zodb" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.