[prev in list] [next in list] [prev in thread] [next in thread]
List: zope3-dev
Subject: RE: [Zope3-dev] RE: [Zope3-checkins] CVS:
From: "Tim Peters" <tim () zope ! com>
Date: 2003-11-06 17:09:41
[Download RAW message or body]
[Gary Poster]
> FWIW, Jim just showed me that
>
> import datetime
> import sys
> sys.modules['datetime._datetime'] = sys.modules['datetime']
>
> works as a hack (which I'm sure is known by most folks, but hey, I
> didn't :-).
Ya, Jim does stuff like that in his sleep without even breaking a snore --
the rest of us have to take a few minutes to recover from cringing <wink>.
Note that the last line can be simplified a bit:
sys.modules['datetime._datetime'] = datetime
That works too.
After doing that dance under Python 2.3.2 in a current Zope3 checkout, I was
indeed able to load pickles (both protocol 0 and protocol 1) containing
datetime objects produced under Python 2.2.3 using Zope3's former Python
datetime implementation.
Note that Python 2.3 pickle supports an "extension code" registry, so that
protocol 2 pickles can contain tiny new opcodes referring to global names
indirectly (they effectively contain an index into a vector of
pre-registered global objects). We haven't exploited that ("we" meaning
neither Python nor Zope) yet, but it was specifically designed to reduce
pickle-size burden for popular classes with long-winded names. A pickle
using this has no chance of being read under pre-2.3 Python, though.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic