From 745dcea6f3e96568f87ad63b56bada3a07cc5ab5 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 21 Nov 2007 19:29:53 +0000 Subject: Rename buffer -> bytearray. --- Modules/datetimemodule.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'Modules') diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index bacc9ef491..573282828d 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -2186,15 +2186,15 @@ date_new(PyTypeObject *type, PyObject *args, PyObject *kw) /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) == 1 && - PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyBytes_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && - MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) + PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyString_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && + MONTH_IS_SANE(PyString_AS_STRING(state)[2])) { PyDateTime_Date *me; me = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (me != NULL) { - char *pdata = PyBytes_AS_STRING(state); + char *pdata = PyString_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATE_DATASIZE); me->hashcode = -1; } @@ -2556,7 +2556,7 @@ date_hash(PyDateTime_Date *self) if (self->hashcode == -1) self->hashcode = generic_hash( (unsigned char *)self->data, _PyDateTime_DATE_DATASIZE); - + return self->hashcode; } @@ -2582,8 +2582,8 @@ static PyObject * date_getstate(PyDateTime_Date *self) { PyObject* field; - field = PyBytes_FromStringAndSize( - (char*)self->data, _PyDateTime_DATE_DATASIZE); + field = PyString_FromStringAndSize((char*)self->data, + _PyDateTime_DATE_DATASIZE); return Py_BuildValue("(N)", field); } @@ -3035,9 +3035,9 @@ time_new(PyTypeObject *type, PyObject *args, PyObject *kw) /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyBytes_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && - ((unsigned char) (PyBytes_AS_STRING(state)[0])) < 24) + PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyString_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && + ((unsigned char) (PyString_AS_STRING(state)[0])) < 24) { PyDateTime_Time *me; char aware; @@ -3053,7 +3053,7 @@ time_new(PyTypeObject *type, PyObject *args, PyObject *kw) aware = (char)(tzinfo != Py_None); me = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (me != NULL) { - char *pdata = PyBytes_AS_STRING(state); + char *pdata = PyString_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_TIME_DATASIZE); me->hashcode = -1; @@ -3385,7 +3385,7 @@ time_getstate(PyDateTime_Time *self) PyObject *basestate; PyObject *result = NULL; - basestate = PyBytes_FromStringAndSize((char *)self->data, + basestate = PyString_FromStringAndSize((char *)self->data, _PyDateTime_TIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) @@ -3569,9 +3569,9 @@ datetime_new(PyTypeObject *type, PyObject *args, PyObject *kw) /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyBytes_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && - MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) + PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyString_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && + MONTH_IS_SANE(PyString_AS_STRING(state)[2])) { PyDateTime_DateTime *me; char aware; @@ -3587,7 +3587,7 @@ datetime_new(PyTypeObject *type, PyObject *args, PyObject *kw) aware = (char)(tzinfo != Py_None); me = (PyDateTime_DateTime *) (type->tp_alloc(type , aware)); if (me != NULL) { - char *pdata = PyBytes_AS_STRING(state); + char *pdata = PyString_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATETIME_DATASIZE); me->hashcode = -1; @@ -4432,8 +4432,8 @@ datetime_getstate(PyDateTime_DateTime *self) PyObject *basestate; PyObject *result = NULL; - basestate = PyBytes_FromStringAndSize((char *)self->data, - _PyDateTime_DATETIME_DATASIZE); + basestate = PyString_FromStringAndSize((char *)self->data, + _PyDateTime_DATETIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) result = PyTuple_Pack(1, basestate); -- cgit v1.2.1