diff options
author | Oren Milman <orenmn@gmail.com> | 2017-09-30 14:06:55 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-09-30 14:06:55 (GMT) |
commit | 40d736bcf40c10aa5fc7d6cc305a6641afd3cd0e (patch) | |
tree | 8f8bb3be3e68b9e00f41b636d91051b01ef309bf /Python | |
parent | 8b83687bdf66d2d10afb78e46bcede399deaefde (diff) | |
download | cpython-40d736bcf40c10aa5fc7d6cc305a6641afd3cd0e.zip cpython-40d736bcf40c10aa5fc7d6cc305a6641afd3cd0e.tar.gz cpython-40d736bcf40c10aa5fc7d6cc305a6641afd3cd0e.tar.bz2 |
[2.7] bpo-31285: Don't raise a SystemError in warnings.warn_explicit() in case __loader__.get_source() has a bad splitlines() method. (GH-3219) (#3823)
(cherry picked from commit 91fb0af)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index dd168f9..37875e5 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -684,8 +684,9 @@ warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds) } /* Split the source into lines. */ - source_list = PyObject_CallMethodObjArgs(source, splitlines_name, - NULL); + source_list = PyObject_CallMethodObjArgs((PyObject *)&PyString_Type, + splitlines_name, source, + NULL); Py_DECREF(source); if (!source_list) return NULL; |