[Python-checkins] python/dist/src/Modules datetimemodule.c, 1.67.8.1, 1.67.8.2

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Mon Jun 7 19:17:51 EDT 2004


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8099/Modules

Modified Files:
      Tag: release23-maint
	datetimemodule.c 
Log Message:
SF 952807:  Unpickling pickled instances of subclasses of
datetime.date, datetime.datetime and datetime.time could yield insane
objects.  Thanks to Jiwon Seo for a fix.


Index: datetimemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v
retrieving revision 1.67.8.1
retrieving revision 1.67.8.2
diff -C2 -d -r1.67.8.1 -r1.67.8.2
*** datetimemodule.c	20 Oct 2003 14:34:46 -0000	1.67.8.1
--- datetimemodule.c	7 Jun 2004 23:17:48 -0000	1.67.8.2
***************
*** 2200,2204 ****
  	    	PyDateTime_Date *me;
  
! 		me = PyObject_New(PyDateTime_Date, type);
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
--- 2200,2204 ----
  	    	PyDateTime_Date *me;
  
! 		me = (PyDateTime_Date *) (type->tp_alloc(type, 0));
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
***************
*** 3043,3048 ****
  		}
  		aware = (char)(tzinfo != Py_None);
! 		me = (PyDateTime_Time *) time_alloc(&PyDateTime_TimeType,
! 						    aware);
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
--- 3043,3047 ----
  		}
  		aware = (char)(tzinfo != Py_None);
! 		me = (PyDateTime_Time *) (type->tp_alloc(type, aware));
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
***************
*** 3565,3571 ****
  		}
  		aware = (char)(tzinfo != Py_None);
! 		me = (PyDateTime_DateTime *) datetime_alloc(
! 						&PyDateTime_DateTimeType,
! 				     		aware);
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
--- 3564,3568 ----
  		}
  		aware = (char)(tzinfo != Py_None);
! 		me = (PyDateTime_DateTime *) (type->tp_alloc(type , aware));
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);




More information about the Python-checkins mailing list