summaryrefslogtreecommitdiffstats
path: root/Modules/datetimemodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-11-21 19:29:53 (GMT)
committerGuido van Rossum <guido@python.org>2007-11-21 19:29:53 (GMT)
commit254348e201647ad9d264de2cc0fde031e8214719 (patch)
treef5e6c42989ce114d4a9385404a6b23b2b1ff12af /Modules/datetimemodule.c
parent905a904723abadc627be60bf944e2ca76329b06e (diff)
downloadcpython-254348e201647ad9d264de2cc0fde031e8214719.zip
cpython-254348e201647ad9d264de2cc0fde031e8214719.tar.gz
cpython-254348e201647ad9d264de2cc0fde031e8214719.tar.bz2
Rename buffer -> bytearray.
Diffstat (limited to 'Modules/datetimemodule.c')
-rw-r--r--Modules/datetimemodule.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index bacc9ef..5732828 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);