diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-09 04:58:54 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-09 04:58:54 (GMT) |
commit | dd96db63f689e2f0d8ae5a1436b3b3395eec7de5 (patch) | |
tree | b2299acac9ce44fc488fc7b2ae2a44548cd5fbb8 /Objects/funcobject.c | |
parent | e98839a1f48b2915f1cc747884e64f4d6e4c8e7a (diff) | |
download | cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.zip cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.gz cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.bz2 |
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.
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r-- | Objects/funcobject.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 216b6da..a2e87b7 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -28,7 +28,7 @@ PyFunction_New(PyObject *code, PyObject *globals) consts = ((PyCodeObject *)code)->co_consts; if (PyTuple_Size(consts) >= 1) { doc = PyTuple_GetItem(consts, 0); - if (!PyBytes_Check(doc) && !PyUnicode_Check(doc)) + if (!PyString_Check(doc) && !PyUnicode_Check(doc)) doc = Py_None; } else @@ -42,7 +42,7 @@ PyFunction_New(PyObject *code, PyObject *globals) Otherwise, use None. */ if (!__name__) { - __name__ = PyBytes_InternFromString("__name__"); + __name__ = PyString_InternFromString("__name__"); if (!__name__) { Py_DECREF(op); return NULL; @@ -254,7 +254,7 @@ func_set_code(PyFunctionObject *op, PyObject *value) PyErr_Format(PyExc_ValueError, "%s() requires a code object with %zd free vars," " not %zd", - PyBytes_AsString(op->func_name), + PyString_AsString(op->func_name), nclosure, nfree); return -1; } @@ -281,7 +281,7 @@ func_set_name(PyFunctionObject *op, PyObject *value) return -1; /* Not legal to del f.func_name or to set it to anything * other than a string object. */ - if (value == NULL || !PyBytes_Check(value)) { + if (value == NULL || !PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; @@ -380,7 +380,7 @@ func_new(PyTypeObject* type, PyObject* args, PyObject* kw) &PyDict_Type, &globals, &name, &defaults, &closure)) return NULL; - if (name != Py_None && !PyBytes_Check(name)) { + if (name != Py_None && !PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "arg 3 (name) must be None or string"); return NULL; @@ -409,7 +409,7 @@ func_new(PyTypeObject* type, PyObject* args, PyObject* kw) if (nfree != nclosure) return PyErr_Format(PyExc_ValueError, "%s requires closure of length %zd, not %zd", - PyBytes_AS_STRING(code->co_name), + PyString_AS_STRING(code->co_name), nfree, nclosure); if (nclosure) { Py_ssize_t i; @@ -465,8 +465,8 @@ func_dealloc(PyFunctionObject *op) static PyObject* func_repr(PyFunctionObject *op) { - return PyBytes_FromFormat("<function %s at %p>", - PyBytes_AsString(op->func_name), + return PyString_FromFormat("<function %s at %p>", + PyString_AsString(op->func_name), op); } |