[3.6] bpo-31285: Fix an assertion failure and a SystemError in warnings.warn_explicit. (GH-3219) (#3775)

(cherry picked from commit 91fb0afe18)
This commit is contained in:
Serhiy Storchaka 2017-09-27 07:38:03 +03:00 committed by GitHub
parent bdb215b18a
commit 90fe25a051
3 changed files with 40 additions and 3 deletions

View file

@ -900,9 +900,7 @@ warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds)
}
/* Split the source into lines. */
source_list = PyObject_CallMethodObjArgs(source,
PyId_splitlines.object,
NULL);
source_list = PyUnicode_Splitlines(source, 0);
Py_DECREF(source);
if (!source_list)
return NULL;