File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ in various ways. There is a separate error indicator for each thread.
134134 This is the most common way to set the error indicator. The first argument
135135 specifies the exception type; it is normally one of the standard exceptions,
136136 e.g. :c:data: `PyExc_RuntimeError `. You need not increment its reference count.
137- The second argument is an error message; it is converted to a string object .
137+ The second argument is an error message; it is decoded from `` 'utf-8 ``' .
138138
139139
140140.. c :function :: void PyErr_SetObject (PyObject *type, PyObject *value)
@@ -261,6 +261,8 @@ in various ways. There is a separate error indicator for each thread.
261261 *filename * is not *NULL *, it is passed to the constructor of *type * as a third
262262 parameter. In the case of exceptions such as :exc: `IOError ` and :exc: `OSError `,
263263 this is used to define the :attr: `filename ` attribute of the exception instance.
264+ *filename * is decoded from the filesystem encoding
265+ (:func: `sys.getfilesystemencoding `).
264266
265267
266268.. c:function:: PyObject* PyErr_SetFromWindowsErr(int ierr)
Original file line number Diff line number Diff line change @@ -60,7 +60,10 @@ typedef struct {
6060
6161PyAPI_FUNC (void ) PyErr_SetNone (PyObject * );
6262PyAPI_FUNC (void ) PyErr_SetObject (PyObject * , PyObject * );
63- PyAPI_FUNC (void ) PyErr_SetString (PyObject * , const char * );
63+ PyAPI_FUNC (void ) PyErr_SetString (
64+ PyObject * exception ,
65+ const char * string /* decoded from utf-8 */
66+ );
6467PyAPI_FUNC (PyObject * ) PyErr_Occurred (void );
6568PyAPI_FUNC (void ) PyErr_Clear (void );
6669PyAPI_FUNC (void ) PyErr_Fetch (PyObject * * , PyObject * * , PyObject * * );
@@ -177,7 +180,9 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
177180PyAPI_FUNC (PyObject * ) PyErr_SetFromErrnoWithFilenameObject (
178181 PyObject * , PyObject * );
179182PyAPI_FUNC (PyObject * ) PyErr_SetFromErrnoWithFilename (
180- PyObject * , const char * );
183+ PyObject * exc ,
184+ const char * filename /* decoded from the filesystem encoding */
185+ );
181186#ifdef MS_WINDOWS
182187PyAPI_FUNC (PyObject * ) PyErr_SetFromErrnoWithUnicodeFilename (
183188 PyObject * , const Py_UNICODE * );
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ What's New in Python 3.2 Alpha 3?
1010Core and Builtins
1111-----------------
1212
13+ - Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
14+ encodings
15+
1316- ast.literal_eval() can now handle negative numbers. It is also a little
1417 more liberal in what it accepts without compromising the safety of the
1518 evaluation. For example, 3j+4 and 3+4+5 are both accepted.
You can’t perform that action at this time.
0 commit comments