summaryrefslogtreecommitdiff
path: root/Modules/parsermodule.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 +0000
committerGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 +0000
commitdd96db63f689e2f0d8ae5a1436b3b3395eec7de5 (patch)
treeb2299acac9ce44fc488fc7b2ae2a44548cd5fbb8 /Modules/parsermodule.c
parente98839a1f48b2915f1cc747884e64f4d6e4c8e7a (diff)
downloadcpython-git-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.gz
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 'Modules/parsermodule.c')
-rw-r--r--Modules/parsermodule.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index 2ff67f2216..6e52343e0d 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -105,14 +105,14 @@ node2tuple(node *n, /* node to convert */
}
if (TYPE(n) == encoding_decl)
- (void) addelem(v, i+1, PyBytes_FromString(STR(n)));
+ (void) addelem(v, i+1, PyString_FromString(STR(n)));
return (v);
}
else if (ISTERMINAL(TYPE(n))) {
PyObject *result = mkseq(2 + lineno + col_offset);
if (result != NULL) {
(void) addelem(result, 0, PyInt_FromLong(TYPE(n)));
- (void) addelem(result, 1, PyBytes_FromString(STR(n)));
+ (void) addelem(result, 1, PyString_FromString(STR(n)));
if (lineno == 1)
(void) addelem(result, 2, PyInt_FromLong(n->n_lineno));
if (col_offset == 1)
@@ -689,7 +689,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
temp = PySequence_GetItem(elem, 1);
if (temp == NULL)
return 0;
- if (!PyBytes_Check(temp)) {
+ if (!PyString_Check(temp)) {
PyErr_Format(parser_error,
"second item in terminal node must be a string,"
" found %s",
@@ -714,10 +714,10 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
Py_DECREF(o);
}
}
- len = PyBytes_GET_SIZE(temp) + 1;
+ len = PyString_GET_SIZE(temp) + 1;
strn = (char *)PyObject_MALLOC(len);
if (strn != NULL)
- (void) memcpy(strn, PyBytes_AS_STRING(temp), len);
+ (void) memcpy(strn, PyString_AS_STRING(temp), len);
Py_DECREF(temp);
}
else if (!ISNONTERMINAL(type)) {
@@ -800,10 +800,10 @@ build_node_tree(PyObject *tuple)
}
if (res && encoding) {
Py_ssize_t len;
- len = PyBytes_GET_SIZE(encoding) + 1;
+ len = PyString_GET_SIZE(encoding) + 1;
res->n_str = (char *)PyObject_MALLOC(len);
if (res->n_str != NULL)
- (void) memcpy(res->n_str, PyBytes_AS_STRING(encoding), len);
+ (void) memcpy(res->n_str, PyString_AS_STRING(encoding), len);
Py_DECREF(encoding);
Py_DECREF(tuple);
}