PyAPI_FUNC(void) PyErr_SyntaxLocation(char *, int);
PyAPI_FUNC(PyObject *) PyErr_ProgramText(char *, int);
+#ifdef Py_USING_UNICODE
/* The following functions are used to create and modify unicode
exceptions from C */
+
/* create a UnicodeDecodeError object */
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
const char *, const char *, int, int, int, const char *);
PyObject *, const char *);
PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
PyObject *, const char *);
+#endif
/* These APIs aren't really part of the error implementation, but
}
+#ifdef Py_USING_UNICODE
PyObject *PyCodec_IgnoreErrors(PyObject *exc)
{
int end;
return NULL;
}
}
+#endif
static PyObject *strict_errors(PyObject *self, PyObject *exc)
{
}
+#ifdef Py_USING_UNICODE
static PyObject *ignore_errors(PyObject *self, PyObject *exc)
{
return PyCodec_IgnoreErrors(exc);
{
return PyCodec_BackslashReplaceErrors(exc);
}
+#endif
void _PyCodecRegistry_Init(void)
METH_O
}
},
+#ifdef Py_USING_UNICODE
{
"ignore",
{
METH_O
}
}
+#endif
};
if (_PyCodec_SearchPath == NULL)
_PyCodec_SearchPath = PyList_New(0);
};
+#ifdef Py_USING_UNICODE
static
int get_int(PyObject *exc, const char *name, int *value)
{
return PyObject_CallFunction(PyExc_UnicodeTranslateError, "u#iis",
object, length, start, end, reason);
}
+#endif
\f
PyDoc_STRVAR(UnicodeError__doc__, "Unicode related error.");
+#ifdef Py_USING_UNICODE
PyDoc_STRVAR(UnicodeEncodeError__doc__, "Unicode encoding error.");
PyDoc_STRVAR(UnicodeDecodeError__doc__, "Unicode decoding error.");
PyDoc_STRVAR(UnicodeTranslateError__doc__, "Unicode translation error.");
+#endif
PyDoc_STRVAR(SystemError__doc__,
"Internal error in the Python interpreter.\n\
FloatingPointError__doc__},
{"ValueError", &PyExc_ValueError, 0, ValueError__doc__},
{"UnicodeError", &PyExc_UnicodeError, &PyExc_ValueError, UnicodeError__doc__},
+#ifdef Py_USING_UNICODE
{"UnicodeEncodeError", &PyExc_UnicodeEncodeError, &PyExc_UnicodeError,
UnicodeEncodeError__doc__, UnicodeEncodeError_methods},
{"UnicodeDecodeError", &PyExc_UnicodeDecodeError, &PyExc_UnicodeError,
UnicodeDecodeError__doc__, UnicodeDecodeError_methods},
{"UnicodeTranslateError", &PyExc_UnicodeTranslateError, &PyExc_UnicodeError,
UnicodeTranslateError__doc__, UnicodeTranslateError_methods},
+#endif
{"ReferenceError", &PyExc_ReferenceError, 0, ReferenceError__doc__},
{"SystemError", &PyExc_SystemError, 0, SystemError__doc__},
{"MemoryError", &PyExc_MemoryError, 0, MemoryError__doc__},