[Python-Dev] new features for 2.3?

Guido van Rossum guido@python.org
Mon, 06 Jan 2003 11:57:08 -0500


I've thought of two things I'd like to land in alpha 2.  Both are
inspired by Zope3 needs (but this doesn't mean Zope Corp is now taking
over making decisions).

First of all, reST is going to be used a lot in Zope3.  Maybe it could
become a standard library module?

Next, I really, really, really would like to improve pickling of
new-style classes.

I've finally come to the conclusion that any solution to making
pickled new-style class instances (and hence pickled datetime objects)
more efficient will require adding new codes to the pickle protocol.

We can do that in Python 2.3.  Because this is backwards incompatible,
I propose that you have to request this protocol explicitly.  I
propose to "upgrade' the binary flag to a general "protocol version"
flag, with values:

0 - original protocol
1 - binary protocol
2 - new protocol

The new protocol can contain an explicit pickle code for the new
datetime objects.  That's about all the thinking I've done so far.  We
need to decide on the new format, but first we must figure out ways
how to efficiently pickle and unpickle subclass instances of
(picklable) built-in types, preferably without having to copy all the
data twice, and instances of new-style classes with slots.  And we
need to implement these twice: in Python for pickle.py and in C for
cPickle.py.

I'd also like to get rid of __safe_for_unpickling__ and all other
pseudo security features.  Attempting to unpickle pickles from an
untrusted source is insane, and nothing can help us there; I'd rather
make the marshal protocol bulletproof (all it needs is a few more
checks for inconsistent data and a little better error handling).

--Guido van Rossum (home page: http://www.python.org/~guido/)