@@ -54,6 +54,9 @@ PyAPI_DATA(PyObject *) PyExc_SystemExit;
5454PyAPI_DATA (PyObject * ) PyExc_TypeError ;
5555PyAPI_DATA (PyObject * ) PyExc_UnboundLocalError ;
5656PyAPI_DATA (PyObject * ) PyExc_UnicodeError ;
57+ PyAPI_DATA (PyObject * ) PyExc_UnicodeEncodeError ;
58+ PyAPI_DATA (PyObject * ) PyExc_UnicodeDecodeError ;
59+ PyAPI_DATA (PyObject * ) PyExc_UnicodeTranslateError ;
5760PyAPI_DATA (PyObject * ) PyExc_ValueError ;
5861PyAPI_DATA (PyObject * ) PyExc_ZeroDivisionError ;
5962#ifdef MS_WINDOWS
@@ -114,6 +117,69 @@ PyAPI_FUNC(void) PyErr_SetInterrupt(void);
114117PyAPI_FUNC (void ) PyErr_SyntaxLocation (char * , int );
115118PyAPI_FUNC (PyObject * ) PyErr_ProgramText (char * , int );
116119
120+ /* The following functions are used to create and modify unicode
121+ exceptions from C */
122+ /* create a UnicodeDecodeError object */
123+ PyAPI_FUNC (PyObject * ) PyUnicodeDecodeError_Create (
124+ const char * , const char * , int , int , int , const char * );
125+
126+ /* create a UnicodeEncodeError object */
127+ PyAPI_FUNC (PyObject * ) PyUnicodeEncodeError_Create (
128+ const char * , const Py_UNICODE * , int , int , int , const char * );
129+
130+ /* create a UnicodeTranslateError object */
131+ PyAPI_FUNC (PyObject * ) PyUnicodeTranslateError_Create (
132+ const Py_UNICODE * , int , int , int , const char * );
133+
134+ /* get the encoding attribute */
135+ PyAPI_FUNC (PyObject * ) PyUnicodeEncodeError_GetEncoding (PyObject * );
136+ PyAPI_FUNC (PyObject * ) PyUnicodeDecodeError_GetEncoding (PyObject * );
137+ PyAPI_FUNC (PyObject * ) PyUnicodeTranslateError_GetEncoding (PyObject * );
138+
139+ /* get the object attribute */
140+ PyAPI_FUNC (PyObject * ) PyUnicodeEncodeError_GetObject (PyObject * );
141+ PyAPI_FUNC (PyObject * ) PyUnicodeDecodeError_GetObject (PyObject * );
142+ PyAPI_FUNC (PyObject * ) PyUnicodeTranslateError_GetObject (PyObject * );
143+
144+ /* get the value of the start attribute (the int * may not be NULL)
145+ return 0 on success, -1 on failure */
146+ PyAPI_FUNC (int ) PyUnicodeEncodeError_GetStart (PyObject * , int * );
147+ PyAPI_FUNC (int ) PyUnicodeDecodeError_GetStart (PyObject * , int * );
148+ PyAPI_FUNC (int ) PyUnicodeTranslateError_GetStart (PyObject * , int * );
149+
150+ /* assign a new value to the start attribute
151+ return 0 on success, -1 on failure */
152+ PyAPI_FUNC (int ) PyUnicodeEncodeError_SetStart (PyObject * , int );
153+ PyAPI_FUNC (int ) PyUnicodeDecodeError_SetStart (PyObject * , int );
154+ PyAPI_FUNC (int ) PyUnicodeTranslateError_SetStart (PyObject * , int );
155+
156+ /* get the value of the end attribute (the int *may not be NULL)
157+ return 0 on success, -1 on failure */
158+ PyAPI_FUNC (int ) PyUnicodeEncodeError_GetEnd (PyObject * , int * );
159+ PyAPI_FUNC (int ) PyUnicodeDecodeError_GetEnd (PyObject * , int * );
160+ PyAPI_FUNC (int ) PyUnicodeTranslateError_GetEnd (PyObject * , int * );
161+
162+ /* assign a new value to the end attribute
163+ return 0 on success, -1 on failure */
164+ PyAPI_FUNC (int ) PyUnicodeEncodeError_SetEnd (PyObject * , int );
165+ PyAPI_FUNC (int ) PyUnicodeDecodeError_SetEnd (PyObject * , int );
166+ PyAPI_FUNC (int ) PyUnicodeTranslateError_SetEnd (PyObject * , int );
167+
168+ /* get the value of the reason attribute */
169+ PyAPI_FUNC (PyObject * ) PyUnicodeEncodeError_GetReason (PyObject * );
170+ PyAPI_FUNC (PyObject * ) PyUnicodeDecodeError_GetReason (PyObject * );
171+ PyAPI_FUNC (PyObject * ) PyUnicodeTranslateError_GetReason (PyObject * );
172+
173+ /* assign a new value to the reason attribute
174+ return 0 on success, -1 on failure */
175+ PyAPI_FUNC (int ) PyUnicodeEncodeError_SetReason (
176+ PyObject * , const char * );
177+ PyAPI_FUNC (int ) PyUnicodeDecodeError_SetReason (
178+ PyObject * , const char * );
179+ PyAPI_FUNC (int ) PyUnicodeTranslateError_SetReason (
180+ PyObject * , const char * );
181+
182+
117183/* These APIs aren't really part of the error implementation, but
118184 often needed to format error messages; the native C lib APIs are
119185 not available on all platforms, which is why we provide emulations
0 commit comments