diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-02-01 02:54:15 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-02-01 02:54:15 (GMT) |
commit | b57f8f02bafcb74cd6c47f59f67d1b6bdfb33aec (patch) | |
tree | 839b9905e3dbb932b37585032356e035a5cfa2f4 /Modules/datetimemodule.c | |
parent | 874d9bcbe5794539a4f6bc1ca46df7841b88f830 (diff) | |
download | cpython-b57f8f02bafcb74cd6c47f59f67d1b6bdfb33aec.zip cpython-b57f8f02bafcb74cd6c47f59f67d1b6bdfb33aec.tar.gz cpython-b57f8f02bafcb74cd6c47f59f67d1b6bdfb33aec.tar.bz2 |
There's no good reason for datetime objects to expose __getstate__()
anymore either, so don't. This also allows to get rid of obscure code
making __getnewargs__ identical to __getstate__ (hmm ... hope there
wasn't more to this than I realize!).
Diffstat (limited to 'Modules/datetimemodule.c')
-rw-r--r-- | Modules/datetimemodule.c | 56 |
1 files changed, 4 insertions, 52 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index 054ddd4..ba2b737 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -1949,6 +1949,7 @@ delta_str(PyDateTime_Delta *self) /* Pickle support, a simple use of __reduce__. */ +/* __getstate__ isn't exposed */ static PyObject * delta_getstate(PyDateTime_Delta *self) { @@ -1979,9 +1980,6 @@ static PyMemberDef delta_members[] = { }; static PyMethodDef delta_methods[] = { - {"__getstate__", (PyCFunction)delta_getstate, METH_NOARGS, - PyDoc_STR("__getstate__() -> state")}, - {"__reduce__", (PyCFunction)delta_reduce, METH_NOARGS, PyDoc_STR("__reduce__() -> (cls, state)")}, @@ -2525,6 +2523,7 @@ date_weekday(PyDateTime_Date *self) /* Pickle support, a simple use of __reduce__. */ +/* __getstate__ isn't exposed */ static PyObject * date_getstate(PyDateTime_Date *self) { @@ -2591,9 +2590,6 @@ static PyMethodDef date_methods[] = { {"replace", (PyCFunction)date_replace, METH_KEYWORDS, PyDoc_STR("Return date with new specified fields.")}, - {"__getstate__", (PyCFunction)date_getstate, METH_NOARGS, - PyDoc_STR("__getstate__() -> state")}, - {"__reduce__", (PyCFunction)date_reduce, METH_NOARGS, PyDoc_STR("__reduce__() -> (cls, state)")}, @@ -3340,6 +3336,7 @@ time_nonzero(PyDateTime_Time *self) /* Let basestate be the non-tzinfo data string. * If tzinfo is None, this returns (basestate,), else (basestate, tzinfo). * So it's a tuple in any (non-error) case. + * __getstate__ isn't exposed. */ static PyObject * time_getstate(PyDateTime_Time *self) @@ -3386,9 +3383,6 @@ static PyMethodDef time_methods[] = { {"replace", (PyCFunction)time_replace, METH_KEYWORDS, PyDoc_STR("Return time with new specified fields.")}, - {"__getstate__", (PyCFunction)time_getstate, METH_NOARGS, - PyDoc_STR("__getstate__() -> state")}, - {"__reduce__", (PyCFunction)time_reduce, METH_NOARGS, PyDoc_STR("__reduce__() -> (cls, state)")}, @@ -4340,6 +4334,7 @@ datetime_utctimetuple(PyDateTime_DateTime *self) /* Let basestate be the non-tzinfo data string. * If tzinfo is None, this returns (basestate,), else (basestate, tzinfo). * So it's a tuple in any (non-error) case. + * __getstate__ isn't exposed. */ static PyObject * datetime_getstate(PyDateTime_DateTime *self) @@ -4431,9 +4426,6 @@ static PyMethodDef datetime_methods[] = { {"astimezone", (PyCFunction)datetime_astimezone, METH_KEYWORDS, PyDoc_STR("tz -> convert to local time in new timezone tz\n")}, - {"__getstate__", (PyCFunction)datetime_getstate, METH_NOARGS, - PyDoc_STR("__getstate__() -> state")}, - {"__reduce__", (PyCFunction)datetime_reduce, METH_NOARGS, PyDoc_STR("__reduce__() -> (cls, state)")}, @@ -4530,46 +4522,6 @@ initdatetime(void) if (PyType_Ready(&PyDateTime_TZInfoType) < 0) return; - /* Make __getnewargs__ a true alias for __getstate__ */ - { - PyObject *d, *f; - - d = PyDateTime_DateType.tp_dict; - f = PyDict_GetItemString(d, "__getstate__"); - if (f != NULL) { - if (PyDict_SetItemString(d, "__getnewargs__", f) < 0) - return; - } - - d = PyDateTime_DateTimeType.tp_dict; - f = PyDict_GetItemString(d, "__getstate__"); - if (f != NULL) { - if (PyDict_SetItemString(d, "__getnewargs__", f) < 0) - return; - } - - d = PyDateTime_DeltaType.tp_dict; - f = PyDict_GetItemString(d, "__getstate__"); - if (f != NULL) { - if (PyDict_SetItemString(d, "__getnewargs__", f) < 0) - return; - } - - d = PyDateTime_TimeType.tp_dict; - f = PyDict_GetItemString(d, "__getstate__"); - if (f != NULL) { - if (PyDict_SetItemString(d, "__getnewargs__", f) < 0) - return; - } - - d = PyDateTime_TZInfoType.tp_dict; - f = PyDict_GetItemString(d, "__getstate__"); - if (f != NULL) { - if (PyDict_SetItemString(d, "__getnewargs__", f) < 0) - return; - } - } - /* timedelta values */ d = PyDateTime_DeltaType.tp_dict; |