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.
This commit is contained in:
Gregory P. Smith 2008-06-09 04:58:54 +00:00
parent e98839a1f4
commit dd96db63f6
173 changed files with 2275 additions and 2280 deletions

View file

@ -495,7 +495,7 @@ Py_Finalize(void)
PyTuple_Fini();
PyList_Fini();
PySet_Fini();
PyBytes_Fini();
PyString_Fini();
PyByteArray_Fini();
PyInt_Fini();
PyFloat_Fini();
@ -744,12 +744,12 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flag
}
v = PySys_GetObject("ps1");
if (v == NULL) {
PySys_SetObject("ps1", v = PyBytes_FromString(">>> "));
PySys_SetObject("ps1", v = PyString_FromString(">>> "));
Py_XDECREF(v);
}
v = PySys_GetObject("ps2");
if (v == NULL) {
PySys_SetObject("ps2", v = PyBytes_FromString("... "));
PySys_SetObject("ps2", v = PyString_FromString("... "));
Py_XDECREF(v);
}
for (;;) {
@ -796,16 +796,16 @@ PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags
v = PyObject_Str(v);
if (v == NULL)
PyErr_Clear();
else if (PyBytes_Check(v))
ps1 = PyBytes_AsString(v);
else if (PyString_Check(v))
ps1 = PyString_AsString(v);
}
w = PySys_GetObject("ps2");
if (w != NULL) {
w = PyObject_Str(w);
if (w == NULL)
PyErr_Clear();
else if (PyBytes_Check(w))
ps2 = PyBytes_AsString(w);
else if (PyString_Check(w))
ps2 = PyString_AsString(w);
}
arena = PyArena_New();
if (arena == NULL) {
@ -898,7 +898,7 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
return -1;
d = PyModule_GetDict(m);
if (PyDict_GetItemString(d, "__file__") == NULL) {
PyObject *f = PyBytes_FromString(filename);
PyObject *f = PyString_FromString(filename);
if (f == NULL)
return -1;
if (PyDict_SetItemString(d, "__file__", f) < 0) {
@ -982,7 +982,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
goto finally;
if (v == Py_None)
*filename = NULL;
else if (! (*filename = PyBytes_AsString(v)))
else if (! (*filename = PyString_AsString(v)))
goto finally;
Py_DECREF(v);
@ -1014,7 +1014,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
goto finally;
if (v == Py_None)
*text = NULL;
else if (! (*text = PyBytes_AsString(v)))
else if (! (*text = PyString_AsString(v)))
goto finally;
Py_DECREF(v);
return 1;
@ -1237,7 +1237,7 @@ PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
if (moduleName == NULL)
err = PyFile_WriteString("<unknown>", f);
else {
char* modstr = PyBytes_AsString(moduleName);
char* modstr = PyString_AsString(moduleName);
if (modstr && strcmp(modstr, "exceptions"))
{
err = PyFile_WriteString(modstr, f);
@ -1261,8 +1261,8 @@ PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
*/
if (s == NULL)
err = -1;
else if (!PyBytes_Check(s) ||
PyBytes_GET_SIZE(s) != 0)
else if (!PyString_Check(s) ||
PyString_GET_SIZE(s) != 0)
err = PyFile_WriteString(": ", f);
if (err == 0)
err = PyFile_WriteObject(s, f, Py_PRINT_RAW);
@ -1581,7 +1581,7 @@ err_input(perrdetail *err)
if (value != NULL) {
u = PyObject_Str(value);
if (u != NULL) {
msg = PyBytes_AsString(u);
msg = PyString_AsString(u);
}
}
if (msg == NULL)