mirror of https://github.com/python/cpython
Issue #10779: PyErr_WarnExplicit() decodes the filename from the filesystem
encoding instead of UTF-8.
This commit is contained in:
parent
8e286c472b
commit
cb428f0162
|
@ -297,8 +297,9 @@ in various ways. There is a separate error indicator for each thread.
|
||||||
is a straightforward wrapper around the Python function
|
is a straightforward wrapper around the Python function
|
||||||
:func:`warnings.warn_explicit`, see there for more information. The *module*
|
:func:`warnings.warn_explicit`, see there for more information. The *module*
|
||||||
and *registry* arguments may be set to *NULL* to get the default effect
|
and *registry* arguments may be set to *NULL* to get the default effect
|
||||||
described there. *message*, *filename* and *module* are UTF-8 encoded
|
described there. *message* and *module* are UTF-8 encoded strings,
|
||||||
strings.
|
*filename* is decoded from the filesystem encoding
|
||||||
|
(:func:`sys.getfilesystemencoding`).
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: int PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level, const char *format, ...)
|
.. c:function:: int PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level, const char *format, ...)
|
||||||
|
|
|
@ -20,7 +20,7 @@ PyAPI_FUNC(int) PyErr_WarnFormat(
|
||||||
PyAPI_FUNC(int) PyErr_WarnExplicit(
|
PyAPI_FUNC(int) PyErr_WarnExplicit(
|
||||||
PyObject *category,
|
PyObject *category,
|
||||||
const char *message, /* UTF-8 encoded string */
|
const char *message, /* UTF-8 encoded string */
|
||||||
const char *filename, /* UTF-8 encoded string */
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
int lineno,
|
int lineno,
|
||||||
const char *module, /* UTF-8 encoded string */
|
const char *module, /* UTF-8 encoded string */
|
||||||
PyObject *registry);
|
PyObject *registry);
|
||||||
|
|
|
@ -8,6 +8,9 @@ What's New in Python 3.2 Release Candidate 1
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #10779: PyErr_WarnExplicit() decodes the filename from the filesystem
|
||||||
|
encoding instead of UTF-8.
|
||||||
|
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -783,7 +783,7 @@ PyErr_WarnExplicit(PyObject *category, const char *text,
|
||||||
{
|
{
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
PyObject *message = PyUnicode_FromString(text);
|
PyObject *message = PyUnicode_FromString(text);
|
||||||
PyObject *filename = PyUnicode_FromString(filename_str);
|
PyObject *filename = PyUnicode_DecodeFSDefault(filename_str);
|
||||||
PyObject *module = NULL;
|
PyObject *module = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue