[Python-checkins] python/nondist/sandbox/datetime datetime.c,1.37,1.38
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Tue, 03 Dec 2002 11:41:56 -0800
- Previous message: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,1.18,1.19 obj_datetime.c,1.13,1.14
- Next message: [Python-checkins] python/nondist/sandbox/datetime datetime.py,1.71,1.72 obj_delta.c,1.19,1.20 test_both.py,1.25,1.26
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv3228
Modified Files:
datetime.c
Log Message:
More pickle cleanups, and since date and datetime no longer participate
in the __reduce__ protocol, stopped adding a __safe_for_unpickling__ attr
to their type dicts.
Index: datetime.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** datetime.c 3 Dec 2002 19:18:15 -0000 1.37
--- datetime.c 3 Dec 2002 19:41:54 -0000 1.38
***************
*** 568,572 ****
--- 568,576 ----
#include "obj_datetime.c"
+
static PyMethodDef module_methods[] = {
+ /* Private functions for pickling support, registered with the
+ * copy_reg module by the module init function.
+ */
{"_date_pickler", (PyCFunction)date_pickler, METH_O, NULL},
{"_date_unpickler", (PyCFunction)date_unpickler, METH_O, NULL},
***************
*** 581,584 ****
--- 585,591 ----
PyObject *m;
PyObject *d, *dt;
+ /* Types that use __reduce__ for pickling need to set the following
+ * magical attr in the type dict, with a true value.
+ */
PyObject *safepickle = PyString_FromString("__safe_for_unpickling__");
***************
*** 595,598 ****
--- 602,606 ----
/* timedelta values */
d = PyDateTime_DeltaType.tp_dict;
+
if (PyDict_SetItem(d, safepickle, Py_True) < 0)
return;
***************
*** 600,605 ****
/* date values */
d = PyDateTime_DateType.tp_dict;
- if (PyDict_SetItem(d, safepickle, Py_True) < 0)
- return;
dt = new_date(1, 1, 1);
--- 608,611 ----
***************
*** 620,625 ****
/* datetime values */
d = PyDateTime_DateTimeType.tp_dict;
- if (PyDict_SetItem(d, safepickle, Py_True) < 0)
- return;
dt = new_datetime(1, 1, 1, 0, 0, 0, 0);
--- 626,629 ----
- Previous message: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,1.18,1.19 obj_datetime.c,1.13,1.14
- Next message: [Python-checkins] python/nondist/sandbox/datetime datetime.py,1.71,1.72 obj_delta.c,1.19,1.20 test_both.py,1.25,1.26
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]