diff options
| author | Martin v. Löwis <martin@v.loewis.de> | 2011-09-28 07:41:54 +0200 |
|---|---|---|
| committer | Martin v. Löwis <martin@v.loewis.de> | 2011-09-28 07:41:54 +0200 |
| commit | d63a3b8beb4a0841cb59fb3515347ccaab34b733 (patch) | |
| tree | 3b4e3cc63151c5a5a910c3550a190aefaea96ad4 /Modules/_datetimemodule.c | |
| parent | 48d49497c50e79d14e9df9527d766ca3a0a38be5 (diff) | |
| download | cpython-git-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.gz | |
Implement PEP 393.
Diffstat (limited to 'Modules/_datetimemodule.c')
| -rw-r--r-- | Modules/_datetimemodule.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 26e0ed0292..a7156a4652 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -985,9 +985,8 @@ append_keyword_tzinfo(PyObject *repr, PyObject *tzinfo) if (tzinfo == Py_None) return repr; /* Get rid of the trailing ')'. */ - assert(PyUnicode_AS_UNICODE(repr)[PyUnicode_GET_SIZE(repr)-1] == ')'); - temp = PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(repr), - PyUnicode_GET_SIZE(repr) - 1); + assert(PyUnicode_READ_CHAR(repr, PyUnicode_GET_LENGTH(repr)-1) == ')'); + temp = PyUnicode_Substring(repr, 0, PyUnicode_GET_LENGTH(repr) - 1); Py_DECREF(repr); if (temp == NULL) return NULL; @@ -4214,9 +4213,9 @@ static PyObject * datetime_strptime(PyObject *cls, PyObject *args) { static PyObject *module = NULL; - const Py_UNICODE *string, *format; + PyObject *string, *format; - if (!PyArg_ParseTuple(args, "uu:strptime", &string, &format)) + if (!PyArg_ParseTuple(args, "UU:strptime", &string, &format)) return NULL; if (module == NULL) { @@ -4224,7 +4223,7 @@ datetime_strptime(PyObject *cls, PyObject *args) if (module == NULL) return NULL; } - return PyObject_CallMethod(module, "_strptime_datetime", "Ouu", + return PyObject_CallMethod(module, "_strptime_datetime", "OOO", cls, string, format); } |
