[Zope3-checkins] CVS: Zope3/src/datetime - _datetime.py:1.34

Guido van Rossum guido@python.org
Fri, 7 Feb 2003 16:45:58 -0500


Update of /cvs-repository/Zope3/src/datetime
In directory cvs.zope.org:/tmp/cvs-serv14479

Modified Files:
	_datetime.py 
Log Message:
Tres discovered a weird bug when a datetime is pickled, caused by the
shadowing of __year, __month, __day and the use of proxies.

Here's a quick fix and a quick unit test.  I don't quite understand
why this wasn't caught by the pickling unit tests.


=== Zope3/src/datetime/_datetime.py 1.33 => 1.34 ===
--- Zope3/src/datetime/_datetime.py:1.33	Fri Feb  7 16:06:38 2003
+++ Zope3/src/datetime/_datetime.py	Fri Feb  7 16:45:27 2003
@@ -1359,7 +1359,7 @@
                 microsecond=0, tzinfo=None):
         if isinstance(year, str):
             # Pickle support
-            self = date.__new__(cls, 1, 1, 1)
+            self = date.__new__(cls, year[:4])
             self.__setstate((year, month))
             return self
         _check_tzinfo_arg(tzinfo)