On Thu, 2002-05-16 at 09:12, Russell A. Blank wrote:
> Thank you for your help.  We were doing exactly that.  I just converted the
> module reference to a singleton and it works great.  I have also run into
> some other issues under Python 2.2.  Apparently, cPickle cannot pickle
> classes with slots without definging a getstate.  I have created a
> work-around, but I thought everyone should know that session store will
> raise an error with slots.

Thank you for the heads up.  I had just started using slots, but had not
gotten to pickling them yet.


In [1]Python 2.2.1c1 we see a first stab at a solution:

-----------------------
What's New in Python 2.2.1c1?
Release date: 18-Mar-2002
=============================

This is primarily a bugfix release.  Many bugs have been fixed since
the release of 2.2 final.  Some of the more notable are listed here.

Core and builtins

- If you try to pickle an instance of a class that has __slots__ but
  doesn't define or override __getstate__, a TypeError is now raised.
  This is done by adding a bozo __getstate__ to the class that always
  raises TypeError.  (Before, this would appear to be pickled, but the
  state of the slots would be lost.)

-----------------------

OK, so this makes you *aware* of the problem, but it doesn't *fix* it.
8-(

 1. <http://www.python.org/2.2.1/NEWS.txt>


The thread beginning with [2] is interesting.  I am now adopting a
personal style guideline to specify all of my __slots__ as tuples.

 2 http://mail.python.org/pipermail/python-dev/2002-February/020072.html


If you add inheritance to the mix, the __(g|s)etstate__ methods quickly
become very nasty.  Perhaps the updated Persistent mixin in zodb3 is the
best solution.

See Message-ID: <[EMAIL PROTECTED]> in [3]

 3. http://lists.zope.org/pipermail/zodb-dev/2002-February.txt




_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to