mirror of https://github.com/python/cpython
Fixed a refcount leak in _PyUnicode_AsDefaultEncodedString().
Found by Amaury Forgeot d'Arc, SF# 1752317. (Also removed a redundant check for !errors.)
This commit is contained in:
parent
dc09715d0b
commit
e7a0d39978
|
@ -1206,10 +1206,7 @@ PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode,
|
|||
v = PyString_FromStringAndSize(PyBytes_AsString(b),
|
||||
PyBytes_Size(b));
|
||||
Py_DECREF(b);
|
||||
if (!errors) {
|
||||
Py_XINCREF(v);
|
||||
((PyUnicodeObject *)unicode)->defenc = v;
|
||||
}
|
||||
((PyUnicodeObject *)unicode)->defenc = v;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue