[Python-checkins] python/dist/src/Modules datetimemodule.c, 1.71, 1.72

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Mon Jun 7 19:04:36 EDT 2004


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

Modified Files:
	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 the fix.

Bugfix candidate.  I'll backport it to 2.3.


Index: datetimemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -C2 -d -r1.71 -r1.72
*** datetimemodule.c	21 Mar 2004 23:38:41 -0000	1.71
--- datetimemodule.c	7 Jun 2004 23:04:33 -0000	1.72
***************
*** 2207,2211 ****
  	    	PyDateTime_Date *me;
  
! 		me = PyObject_New(PyDateTime_Date, type);
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
--- 2207,2211 ----
  	    	PyDateTime_Date *me;
  
! 		me = (PyDateTime_Date *) (type->tp_alloc(type, 0));
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
***************
*** 3050,3055 ****
  		}
  		aware = (char)(tzinfo != Py_None);
! 		me = (PyDateTime_Time *) time_alloc(&PyDateTime_TimeType,
! 						    aware);
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
--- 3050,3054 ----
  		}
  		aware = (char)(tzinfo != Py_None);
! 		me = (PyDateTime_Time *) (type->tp_alloc(type, aware));
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
***************
*** 3573,3579 ****
  		}
  		aware = (char)(tzinfo != Py_None);
! 		me = (PyDateTime_DateTime *) datetime_alloc(
! 						&PyDateTime_DateTimeType,
! 				     		aware);
  		if (me != NULL) {
  			char *pdata = PyString_AS_STRING(state);
--- 3572,3576 ----
  		}
  		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