diff options
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Python/errors.c b/Python/errors.c index 8951d57..8b04c34 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -66,7 +66,7 @@ PyErr_SetNone(PyObject *exception) void PyErr_SetString(PyObject *exception, const char *string) { - PyObject *value = PyString_FromString(string); + PyObject *value = PyBytes_FromString(string); PyErr_SetObject(exception, value); Py_XDECREF(value); } @@ -351,7 +351,7 @@ PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject) PyObject * PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) { - PyObject *name = filename ? PyString_FromString(filename) : NULL; + PyObject *name = filename ? PyBytes_FromString(filename) : NULL; PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); Py_XDECREF(name); return result; @@ -430,7 +430,7 @@ PyObject *PyErr_SetExcFromWindowsErrWithFilename( int ierr, const char *filename) { - PyObject *name = filename ? PyString_FromString(filename) : NULL; + PyObject *name = filename ? PyBytes_FromString(filename) : NULL; PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObject(exc, ierr, name); @@ -469,7 +469,7 @@ PyObject *PyErr_SetFromWindowsErrWithFilename( int ierr, const char *filename) { - PyObject *name = filename ? PyString_FromString(filename) : NULL; + PyObject *name = filename ? PyBytes_FromString(filename) : NULL; PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject( PyExc_WindowsError, ierr, name); @@ -527,7 +527,7 @@ PyErr_Format(PyObject *exception, const char *format, ...) va_start(vargs); #endif - string = PyString_FromFormatV(format, vargs); + string = PyBytes_FromFormatV(format, vargs); PyErr_SetObject(exception, string); Py_XDECREF(string); va_end(vargs); @@ -559,7 +559,7 @@ PyErr_NewException(char *name, PyObject *base, PyObject *dict) goto failure; } if (PyDict_GetItemString(dict, "__module__") == NULL) { - modulename = PyString_FromStringAndSize(name, + modulename = PyBytes_FromStringAndSize(name, (Py_ssize_t)(dot-name)); if (modulename == NULL) goto failure; @@ -611,7 +611,7 @@ PyErr_WriteUnraisable(PyObject *obj) if (moduleName == NULL) PyFile_WriteString("<unknown>", f); else { - char* modstr = PyString_AsString(moduleName); + char* modstr = PyBytes_AsString(moduleName); if (modstr && strcmp(modstr, "exceptions") != 0) { @@ -665,7 +665,7 @@ PyErr_SyntaxLocation(const char *filename, int lineno) Py_DECREF(tmp); } if (filename != NULL) { - tmp = PyString_FromString(filename); + tmp = PyBytes_FromString(filename); if (tmp == NULL) PyErr_Clear(); else { @@ -742,7 +742,7 @@ PyErr_ProgramText(const char *filename, int lineno) char *p = linebuf; while (*p == ' ' || *p == '\t' || *p == '\014') p++; - return PyString_FromString(p); + return PyBytes_FromString(p); } return NULL; } |