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/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/ast.c')
-rw-r--r-- | Python/ast.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Python/ast.c b/Python/ast.c index ef0d8be..a6bb1b7 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -46,7 +46,7 @@ static PyObject *parsestrplus(struct compiling *, const node *n); static identifier new_identifier(const char* n, PyArena *arena) { - PyObject* id = PyBytes_InternFromString(n); + PyObject* id = PyString_InternFromString(n); PyArena_AddPyObject(arena, id); return id; } @@ -1291,7 +1291,7 @@ ast_for_atom(struct compiling *c, const node *n) if (errstr) { char *s = ""; char buf[128]; - s = PyBytes_AsString(errstr); + s = PyString_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); } else { @@ -2333,10 +2333,10 @@ alias_for_import_name(struct compiling *c, const node *n) /* length of string plus one for the dot */ len += strlen(STR(CHILD(n, i))) + 1; len--; /* the last name doesn't have a dot */ - str = PyBytes_FromStringAndSize(NULL, len); + str = PyString_FromStringAndSize(NULL, len); if (!str) return NULL; - s = PyBytes_AS_STRING(str); + s = PyString_AS_STRING(str); if (!s) return NULL; for (i = 0; i < NCH(n); i += 2) { @@ -2347,13 +2347,13 @@ alias_for_import_name(struct compiling *c, const node *n) } --s; *s = '\0'; - PyBytes_InternInPlace(&str); + PyString_InternInPlace(&str); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); } break; case STAR: - str = PyBytes_InternFromString("*"); + str = PyString_InternFromString("*"); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); default: @@ -3201,10 +3201,10 @@ decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, cons u = NULL; } else { /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ - u = PyBytes_FromStringAndSize((char *)NULL, len * 4); + u = PyString_FromStringAndSize((char *)NULL, len * 4); if (u == NULL) return NULL; - p = buf = PyBytes_AsString(u); + p = buf = PyString_AsString(u); end = s + len; while (s < end) { if (*s == '\\') { @@ -3223,8 +3223,8 @@ decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, cons Py_DECREF(u); return NULL; } - r = PyBytes_AsString(w); - rn = PyBytes_Size(w); + r = PyString_AsString(w); + rn = PyString_Size(w); assert(rn % 2 == 0); for (i = 0; i < rn; i += 2) { sprintf(p, "\\u%02x%02x", @@ -3323,11 +3323,11 @@ parsestr(struct compiling *c, const char *s) return v; #endif } else { - return PyBytes_FromStringAndSize(s, len); + return PyString_FromStringAndSize(s, len); } } - return PyBytes_DecodeEscape(s, len, NULL, unicode, + return PyString_DecodeEscape(s, len, NULL, unicode, need_encoding ? c->c_encoding : NULL); } @@ -3348,8 +3348,8 @@ parsestrplus(struct compiling *c, const node *n) s = parsestr(c, STR(CHILD(n, i))); if (s == NULL) goto onError; - if (PyBytes_Check(v) && PyBytes_Check(s)) { - PyBytes_ConcatAndDel(&v, s); + if (PyString_Check(v) && PyString_Check(s)) { + PyString_ConcatAndDel(&v, s); if (v == NULL) goto onError; } |