summaryrefslogtreecommitdiffstats
path: root/Python/peephole.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 (GMT)
commitdd96db63f689e2f0d8ae5a1436b3b3395eec7de5 (patch)
treeb2299acac9ce44fc488fc7b2ae2a44548cd5fbb8 /Python/peephole.c
parente98839a1f48b2915f1cc747884e64f4d6e4c8e7a (diff)
downloadcpython-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/peephole.c')
-rw-r--r--Python/peephole.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Python/peephole.c b/Python/peephole.c
index df19726..e9da377 100644
--- a/Python/peephole.c
+++ b/Python/peephole.c
@@ -300,15 +300,15 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
goto exitUnchanged;
/* Bypass optimization when the lineno table is too complex */
- assert(PyBytes_Check(lineno_obj));
- lineno = (unsigned char*)PyBytes_AS_STRING(lineno_obj);
- tabsiz = PyBytes_GET_SIZE(lineno_obj);
+ assert(PyString_Check(lineno_obj));
+ lineno = (unsigned char*)PyString_AS_STRING(lineno_obj);
+ tabsiz = PyString_GET_SIZE(lineno_obj);
if (memchr(lineno, 255, tabsiz) != NULL)
goto exitUnchanged;
/* Avoid situations where jump retargeting could overflow */
- assert(PyBytes_Check(code));
- codelen = PyBytes_GET_SIZE(code);
+ assert(PyString_Check(code));
+ codelen = PyString_GET_SIZE(code);
if (codelen > 32700)
goto exitUnchanged;
@@ -317,7 +317,7 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
if (codestr == NULL)
goto exitUnchanged;
codestr = (unsigned char *)memcpy(codestr,
- PyBytes_AS_STRING(code), codelen);
+ PyString_AS_STRING(code), codelen);
/* Verify that RETURN_VALUE terminates the codestring. This allows
the various transformation patterns to look ahead several
@@ -382,7 +382,7 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
case LOAD_NAME:
case LOAD_GLOBAL:
j = GETARG(codestr, i);
- name = PyBytes_AsString(PyTuple_GET_ITEM(names, j));
+ name = PyString_AsString(PyTuple_GET_ITEM(names, j));
if (name == NULL || strcmp(name, "None") != 0)
continue;
for (j=0 ; j < PyList_GET_SIZE(consts) ; j++) {
@@ -612,7 +612,7 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
}
assert(h + nops == codelen);
- code = PyBytes_FromStringAndSize((char *)codestr, h);
+ code = PyString_FromStringAndSize((char *)codestr, h);
PyMem_Free(addrmap);
PyMem_Free(codestr);
PyMem_Free(blocks);