mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
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.
This commit is contained in:
parent
e98839a1f4
commit
dd96db63f6
173 changed files with 2275 additions and 2280 deletions
|
@ -303,7 +303,7 @@ PyComplex_AsCComplex(PyObject *op)
|
|||
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 @@ complex_repr(PyComplexObject *v)
|
|||
{
|
||||
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 @@ complex_str(PyComplexObject *v)
|
|||
{
|
||||
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 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
|
|||
#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 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
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 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
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 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
|
||||
/* XXX Hack to support classes with __complex__ method */
|
||||
if (complexstr == NULL) {
|
||||
complexstr = PyBytes_InternFromString("__complex__");
|
||||
complexstr = PyString_InternFromString("__complex__");
|
||||
if (complexstr == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue