Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(90214)

Unified Diff: Python/_warnings.c

Issue 11619: On Windows, don't encode filenames in the import machinery
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Python/symtable.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Python/_warnings.c Mon Aug 26 14:05:19 2013 +0200
+++ b/Python/_warnings.c Mon Aug 26 16:10:52 2013 +0200
@@ -707,14 +707,14 @@ warnings_warn_explicit(PyObject *self, P
/* Handle the warning. */
returned = warn_explicit(category, message, filename, lineno, module,
- registry, source_line);
+ registry, source_line);
Py_DECREF(source_list);
return returned;
}
standard_call:
return warn_explicit(category, message, filename, lineno, module,
- registry, NULL);
+ registry, NULL);
}
@@ -786,11 +786,26 @@ PyErr_Warn(PyObject *category, char *tex
/* Warning with explicit origin */
int
+PyErr_WarnExplicitObject(PyObject *category, PyObject *message,
+ PyObject *filename, int lineno,
+ PyObject *module, PyObject *registry)
+{
+ PyObject *res;
+ if (category == NULL)
+ category = PyExc_RuntimeWarning;
+ res = warn_explicit(category, message, filename, lineno,
+ module, registry, NULL);
+ if (res == NULL)
+ return -1;
+ Py_DECREF(res);
+ return 0;
+}
+
+int
PyErr_WarnExplicit(PyObject *category, const char *text,
const char *filename_str, int lineno,
const char *module_str, PyObject *registry)
{
- PyObject *res;
PyObject *message = PyUnicode_FromString(text);
PyObject *filename = PyUnicode_DecodeFSDefault(filename_str);
PyObject *module = NULL;
@@ -804,14 +819,8 @@ PyErr_WarnExplicit(PyObject *category, c
goto exit;
}
- if (category == NULL)
- category = PyExc_RuntimeWarning;
- res = warn_explicit(category, message, filename, lineno, module, registry,
- NULL);
- if (res == NULL)
- goto exit;
- Py_DECREF(res);
- ret = 0;
+ ret = PyErr_WarnExplicitObject(category, message, filename, lineno,
+ module, registry);
exit:
Py_XDECREF(message);
« no previous file with comments | « Python/symtable.c ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+