[Python-checkins] python/nondist/sandbox/datetime datetime.py,1.111,1.112 doc.txt,1.61,1.62

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Fri, 20 Dec 2002 12:42:38 -0800


Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv28755

Modified Files:
	datetime.py doc.txt 
Log Message:
Gave timedelta an explicit __reduce__.  This may make the C and Python
pickles for timedeltas compatible.


Index: datetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v
retrieving revision 1.111
retrieving revision 1.112
diff -C2 -d -r1.111 -r1.112
*** datetime.py	17 Dec 2002 02:04:41 -0000	1.111
--- datetime.py	20 Dec 2002 20:42:34 -0000	1.112
***************
*** 547,550 ****
--- 547,553 ----
      __safe_for_unpickling__ = True
  
+     def __reduce__(self):
+         return type(self), (), self.__getstate__()
+ 
      def __getstate__(self):
          return (self.__days, self.__seconds, self.__microseconds)

Index: doc.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/doc.txt,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** doc.txt	17 Dec 2002 02:04:41 -0000	1.61
--- doc.txt	20 Dec 2002 20:42:35 -0000	1.62
***************
*** 24,27 ****
--- 24,28 ----
    implementation won't be readable when Zope3 moves to Python 2.3.
  
+   XXX This one (timedelta) is probably fixed now.
    Trying to read a Python (2.2.2) timedelta pickle under the C
    implementation (2.3):
***************
*** 38,42 ****
      obj = base.__new__(cls, state)
  TypeError: object.__new__(datetime.timedelta) is not safe, use datetime.timedelta.__new__()
!   
  
    Trying to read a Python (2.2.2) timetz pickle under the C
--- 39,43 ----
      obj = base.__new__(cls, state)
  TypeError: object.__new__(datetime.timedelta) is not safe, use datetime.timedelta.__new__()
! 
  
    Trying to read a Python (2.2.2) timetz pickle under the C
***************
*** 56,60 ****
      obj = base.__new__(cls, state)
  TypeError: object.__new__(EST) is not safe, use datetime.tzinfo.__new__()
!   
  
    Trying to read a Python (2.2.2) datetimetz pickle under the C
--- 57,61 ----
      obj = base.__new__(cls, state)
  TypeError: object.__new__(EST) is not safe, use datetime.tzinfo.__new__()
! 
  
    Trying to read a Python (2.2.2) datetimetz pickle under the C