]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
authorVictor Stinner <victor.stinner@haypocalc.com>
Sat, 9 Oct 2010 10:12:11 +0000 (10:12 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sat, 9 Oct 2010 10:12:11 +0000 (10:12 +0000)
encodings

Doc/c-api/exceptions.rst
Include/pyerrors.h
Misc/NEWS

index 3fce3b21b4c89a11d38fd0f842733c598c2d978a..0094af36923c19654a0068949f79fbb0fa74f661 100644 (file)
@@ -134,7 +134,7 @@ in various ways.  There is a separate error indicator for each thread.
    This is the most common way to set the error indicator.  The first argument
    specifies the exception type; it is normally one of the standard exceptions,
    e.g. :c:data:`PyExc_RuntimeError`.  You need not increment its reference count.
-   The second argument is an error message; it is converted to a string object.
+   The second argument is an error message; it is decoded from ``'utf-8``'.
 
 
 .. 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.
    *filename* is not *NULL*, it is passed to the constructor of *type* as a third
    parameter.  In the case of exceptions such as :exc:`IOError` and :exc:`OSError`,
    this is used to define the :attr:`filename` attribute of the exception instance.
+   *filename* is decoded from the filesystem encoding
+   (:func:`sys.getfilesystemencoding`).
 
 
 .. c:function:: PyObject* PyErr_SetFromWindowsErr(int ierr)
index fb9ce91a84ea3bf6ab75dc25eeda825432da76e0..58a3df731ee0831c495b6cc657cdc4149008bedb 100644 (file)
@@ -60,7 +60,10 @@ typedef struct {
 
 PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
 PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
-PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *);
+PyAPI_FUNC(void) PyErr_SetString(
+    PyObject *exception,
+    const char *string   /* decoded from utf-8 */
+    );
 PyAPI_FUNC(PyObject *) PyErr_Occurred(void);
 PyAPI_FUNC(void) PyErr_Clear(void);
 PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
@@ -177,7 +180,9 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
     PyObject *, PyObject *);
 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
-    PyObject *, const char *);
+    PyObject *exc,
+    const char *filename   /* decoded from the filesystem encoding */
+    );
 #ifdef MS_WINDOWS
 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
     PyObject *, const Py_UNICODE *);
index 64e03a00ef5a2492aec65b74e0b85562d3e3eb5a..ac731c56b0547d09c9eb17df5c40d8032b90fe64 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.2 Alpha 3?
 Core and Builtins
 -----------------
 
+- Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
+  encodings
+
 - ast.literal_eval() can now handle negative numbers.  It is also a little
   more liberal in what it accepts without compromising the safety of the
   evaluation.  For example, 3j+4 and 3+4+5 are both accepted.