Convert a bunch of constant strings in C to unicode.

This commit is contained in:
Neal Norwitz 2007-08-23 21:42:55 +00:00
parent d6d2f2f939
commit 53cbdaa84c
7 changed files with 8 additions and 8 deletions

View File

@ -472,7 +472,7 @@ init_curses_panel(void)
PyDict_SetItemString(d, "error", PyCursesError); PyDict_SetItemString(d, "error", PyCursesError);
/* Make the version available */ /* Make the version available */
v = PyString_FromString(PyCursesVersion); v = PyUnicode_FromString(PyCursesVersion);
PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "version", v);
PyDict_SetItemString(d, "__version__", v); PyDict_SetItemString(d, "__version__", v);
Py_DECREF(v); Py_DECREF(v);

View File

@ -2048,7 +2048,7 @@ initbz2(void)
if (m == NULL) if (m == NULL)
return; return;
PyModule_AddObject(m, "__author__", PyString_FromString(__author__)); PyModule_AddObject(m, "__author__", PyUnicode_FromString(__author__));
Py_INCREF(&BZ2File_Type); Py_INCREF(&BZ2File_Type);
PyModule_AddObject(m, "BZ2File", (PyObject *)&BZ2File_Type); PyModule_AddObject(m, "BZ2File", (PyObject *)&BZ2File_Type);

View File

@ -851,7 +851,7 @@ collect(int generation)
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
if (gc_str == NULL) if (gc_str == NULL)
gc_str = PyString_FromString("garbage collection"); gc_str = PyUnicode_FromString("garbage collection");
PyErr_WriteUnraisable(gc_str); PyErr_WriteUnraisable(gc_str);
Py_FatalError("unexpected exception during garbage collection"); Py_FatalError("unexpected exception during garbage collection");
} }

View File

@ -1039,7 +1039,7 @@ PyInit_zlib(void)
PyModule_AddIntConstant(m, "Z_SYNC_FLUSH", Z_SYNC_FLUSH); PyModule_AddIntConstant(m, "Z_SYNC_FLUSH", Z_SYNC_FLUSH);
PyModule_AddIntConstant(m, "Z_FULL_FLUSH", Z_FULL_FLUSH); PyModule_AddIntConstant(m, "Z_FULL_FLUSH", Z_FULL_FLUSH);
ver = PyString_FromString(ZLIB_VERSION); ver = PyUnicode_FromString(ZLIB_VERSION);
if (ver != NULL) if (ver != NULL)
PyModule_AddObject(m, "ZLIB_VERSION", ver); PyModule_AddObject(m, "ZLIB_VERSION", ver);

View File

@ -194,7 +194,7 @@ PyDict_New(void)
{ {
register dictobject *mp; register dictobject *mp;
if (dummy == NULL) { /* Auto-initialize dummy */ if (dummy == NULL) { /* Auto-initialize dummy */
dummy = PyString_FromString("<dummy key>"); dummy = PyUnicode_FromString("<dummy key>");
if (dummy == NULL) if (dummy == NULL)
return NULL; return NULL;
#ifdef SHOW_CONVERSION_COUNTS #ifdef SHOW_CONVERSION_COUNTS

View File

@ -142,7 +142,7 @@ PyList_GetItem(PyObject *op, Py_ssize_t i)
} }
if (i < 0 || i >= Py_Size(op)) { if (i < 0 || i >= Py_Size(op)) {
if (indexerr == NULL) if (indexerr == NULL)
indexerr = PyString_FromString( indexerr = PyUnicode_FromString(
"list index out of range"); "list index out of range");
PyErr_SetObject(PyExc_IndexError, indexerr); PyErr_SetObject(PyExc_IndexError, indexerr);
return NULL; return NULL;
@ -362,7 +362,7 @@ list_item(PyListObject *a, Py_ssize_t i)
{ {
if (i < 0 || i >= Py_Size(a)) { if (i < 0 || i >= Py_Size(a)) {
if (indexerr == NULL) if (indexerr == NULL)
indexerr = PyString_FromString( indexerr = PyUnicode_FromString(
"list index out of range"); "list index out of range");
PyErr_SetObject(PyExc_IndexError, indexerr); PyErr_SetObject(PyExc_IndexError, indexerr);
return NULL; return NULL;

View File

@ -966,7 +966,7 @@ make_new_set(PyTypeObject *type, PyObject *iterable)
register PySetObject *so = NULL; register PySetObject *so = NULL;
if (dummy == NULL) { /* Auto-initialize dummy */ if (dummy == NULL) { /* Auto-initialize dummy */
dummy = PyString_FromString("<dummy key>"); dummy = PyUnicode_FromString("<dummy key>");
if (dummy == NULL) if (dummy == NULL)
return NULL; return NULL;
} }