On Sun, Mar 10, 2013 at 11:25 AM, Tres Seaver <tsea...@palladion.com> wrote:
> Hash: SHA1
> On 03/10/2013 09:19 AM, Jim Fulton wrote:
>> I think the fix is pretty straightforward.
>> In the default __setstate__ provided by Persistent, and when loading
>> non-persistent instances:
>> - On Python 2, ASCII encode unicode attribute names.
>> - On Python 3, ASCII decode byte attribute names.
>> The same transformation is necessary when looking up global names.
> Hmm, if zodbpickle has to handle the issue for non-persistent instances
> and global names, wouldn't it be simpler to make it handle persistent
> instances too?

No.  It can't know when a key is going to be used for a
persistent attribute name.

>  It can examine the stack inside 'load_dict' to figure out
> that the context is an instance, right?

Ugh.  What stack?

It would be much simpler to handle this in __setstate__ (or the equivalent).
This isn't exactly a lot of code.


Jim Fulton
Jerky is better than bacon! http://zo.pe/Kqm
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to