[Python-3000-checkins] r57411 - python/branches/py3k/Python/errors.c

neal.norwitz python-3000-checkins at python.org
Fri Aug 24 21:54:13 CEST 2007


Author: neal.norwitz
Date: Fri Aug 24 21:54:13 2007
New Revision: 57411

Modified:
   python/branches/py3k/Python/errors.c
Log:
Use unicode for much of errors.

Modified: python/branches/py3k/Python/errors.c
==============================================================================
--- python/branches/py3k/Python/errors.c	(original)
+++ python/branches/py3k/Python/errors.c	Fri Aug 24 21:54:13 2007
@@ -350,7 +350,7 @@
 PyObject *
 PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename)
 {
-	PyObject *name = filename ? PyString_FromString(filename) : NULL;
+	PyObject *name = filename ? PyUnicode_FromString(filename) : NULL;
 	PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name);
 	Py_XDECREF(name);
 	return result;
@@ -429,7 +429,7 @@
 	int ierr,
 	const char *filename)
 {
-	PyObject *name = filename ? PyString_FromString(filename) : NULL;
+	PyObject *name = filename ? PyUnicode_FromString(filename) : NULL;
 	PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObject(exc,
 	                                                             ierr,
 	                                                             name);
@@ -468,7 +468,7 @@
 	int ierr,
 	const char *filename)
 {
-	PyObject *name = filename ? PyString_FromString(filename) : NULL;
+	PyObject *name = filename ? PyUnicode_FromString(filename) : NULL;
 	PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject(
 						      PyExc_WindowsError,
 						      ierr, name);
@@ -558,7 +558,7 @@
 			goto failure;
 	}
 	if (PyDict_GetItemString(dict, "__module__") == NULL) {
-		modulename = PyString_FromStringAndSize(name,
+		modulename = PyUnicode_FromStringAndSize(name,
 						     (Py_ssize_t)(dot-name));
 		if (modulename == NULL)
 			goto failure;
@@ -610,7 +610,7 @@
 			if (moduleName == NULL)
 				PyFile_WriteString("<unknown>", f);
 			else {
-				char* modstr = PyString_AsString(moduleName);
+				char* modstr = PyUnicode_AsString(moduleName);
 				if (modstr &&
 				    strcmp(modstr, "__builtin__") != 0)
 				{
@@ -728,7 +728,7 @@
 		Py_DECREF(tmp);
 	}
 	if (filename != NULL) {
-		tmp = PyString_FromString(filename);
+		tmp = PyUnicode_FromString(filename);
 		if (tmp == NULL)
 			PyErr_Clear();
 		else {
@@ -805,7 +805,7 @@
 		char *p = linebuf;
 		while (*p == ' ' || *p == '\t' || *p == '\014')
 			p++;
-		return PyString_FromString(p);
+		return PyUnicode_FromString(p);
 	}
 	return NULL;
 }


More information about the Python-3000-checkins mailing list