Kaydet (Commit) ae62f015 authored tarafından Zackery Spytz's avatar Zackery Spytz Kaydeden (comit) Serhiy Storchaka

bpo-34910: Ensure that PyObject_Print() always returns -1 on error. (GH-9733)

üst cd45385f
Ensure that :c:func:`PyObject_Print` always returns ``-1`` on error. Patch
by Zackery Spytz.
......@@ -375,8 +375,9 @@ PyObject_Print(PyObject *op, FILE *fp, int flags)
else if (PyUnicode_Check(s)) {
PyObject *t;
t = PyUnicode_AsEncodedString(s, "utf-8", "backslashreplace");
if (t == NULL)
ret = 0;
if (t == NULL) {
ret = -1;
}
else {
fwrite(PyBytes_AS_STRING(t), 1,
PyBytes_GET_SIZE(t), fp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment