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 /Python/Python-ast.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 'Python/Python-ast.c')
-rw-r--r-- | Python/Python-ast.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 35a3d27..f958145 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -495,7 +495,7 @@ static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int fnames = PyTuple_New(num_fields); if (!fnames) return NULL; for (i = 0; i < num_fields; i++) { - PyObject *field = PyBytes_FromString(fields[i]); + PyObject *field = PyString_FromString(fields[i]); if (!field) { Py_DECREF(fnames); return NULL; @@ -514,7 +514,7 @@ static int add_attributes(PyTypeObject* type, char**attrs, int num_fields) PyObject *s, *l = PyTuple_New(num_fields); if (!l) return 0; for(i = 0; i < num_fields; i++) { - s = PyBytes_FromString(attrs[i]); + s = PyString_FromString(attrs[i]); if (!s) { Py_DECREF(l); return 0; @@ -588,7 +588,7 @@ static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -606,7 +606,7 @@ static int obj2ast_bool(PyObject* obj, bool* out, PyArena* arena) PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -3286,7 +3286,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -4414,7 +4414,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5261,7 +5261,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5299,7 +5299,7 @@ obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5417,7 +5417,7 @@ obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5439,7 +5439,7 @@ obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5501,7 +5501,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5531,7 +5531,7 @@ obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5585,7 +5585,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5751,7 +5751,7 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena) tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; |