Mercurial > cpython-lru_cache-weakref
diff Objects/complexobject.c @ 47527:52294af4b663 legacy-trunk
This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
| author | Gregory P. Smith <greg@mad-scientist.com> |
|---|---|
| date | Mon, 09 Jun 2008 04:58:54 +0000 |
| parents | 71bed208fe50 |
| children | 587c8e3917c6 33312b910773 |
line wrap: on
line diff
--- a/Objects/complexobject.c Mon Jun 09 01:28:30 2008 +0000 +++ b/Objects/complexobject.c Mon Jun 09 04:58:54 2008 +0000 @@ -303,7 +303,7 @@ cv.imag = 0.; if (complex_str == NULL) { - if (!(complex_str = PyBytes_InternFromString("__complex__"))) + if (!(complex_str = PyString_InternFromString("__complex__"))) return cv; } @@ -421,7 +421,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_REPR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyObject * @@ -429,7 +429,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_STR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static long @@ -877,9 +877,9 @@ #endif Py_ssize_t len; - if (PyBytes_Check(v)) { - s = PyBytes_AS_STRING(v); - len = PyBytes_GET_SIZE(v); + if (PyString_Check(v)) { + s = PyString_AS_STRING(v); + len = PyString_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -1065,7 +1065,7 @@ Py_INCREF(r); return r; } - if (PyBytes_Check(r) || PyUnicode_Check(r)) { + if (PyString_Check(r) || PyUnicode_Check(r)) { if (i != NULL) { PyErr_SetString(PyExc_TypeError, "complex() can't take second arg" @@ -1074,7 +1074,7 @@ } return complex_subtype_from_string(type, r); } - if (i != NULL && (PyBytes_Check(i) || PyUnicode_Check(i))) { + if (i != NULL && (PyString_Check(i) || PyUnicode_Check(i))) { PyErr_SetString(PyExc_TypeError, "complex() second arg can't be a string"); return NULL; @@ -1082,7 +1082,7 @@ /* XXX Hack to support classes with __complex__ method */ if (complexstr == NULL) { - complexstr = PyBytes_InternFromString("__complex__"); + complexstr = PyString_InternFromString("__complex__"); if (complexstr == NULL) return NULL; }
