Re: [Python-checkins] python/nondist/sandbox/datetime obj_delta.c,1.14,1.15 test_both.py,1.15,1.16

tim_one@users.sourceforge.net writes:
You need to arrange for a module name to appear in timedelta's tp_name: Index: obj_delta.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_delta.c,v retrieving revision 1.15 diff -c -r1.15 obj_delta.c *** obj_delta.c 2 Dec 2002 17:31:21 -0000 1.15 --- obj_delta.c 2 Dec 2002 17:37:55 -0000 *************** *** 673,679 **** static PyTypeObject PyDateTime_DeltaType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "timedelta", /* tp_name */ sizeof(PyDateTime_Delta), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ --- 673,679 ---- static PyTypeObject PyDateTime_DeltaType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "datetime.timedelta", /* tp_name */ sizeof(PyDateTime_Delta), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ seems a good bet. Cheers, M. -- I'm not sure that the ability to create routing diagrams similar to pretzels with mad cow disease is actually a marketable skill. -- Steve Levin -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html

[Michael Hudson]
You need to arrange for a module name to appear in timedelta's tp_name:
Ya, I figured that out. The next surprise was the need to create a __safe_for_unpickling__ attr in the type's dict. This was confusing because none of it was necessary for the Python implementation of this stuff, and examples of the necessity for, and mechanics of, __reduce__, were hard to find.

[Michael Hudson]
You need to arrange for a module name to appear in timedelta's tp_name:
Ya, I figured that out. The next surprise was the need to create a __safe_for_unpickling__ attr in the type's dict. This was confusing because none of it was necessary for the Python implementation of this stuff, and examples of the necessity for, and mechanics of, __reduce__, were hard to find.
participants (2)
-
Michael Hudson
-
Tim Peters