mirror of https://github.com/python/cpython
bpo-46881: Fix refleak from GH-31616 (GH-31805)
This commit is contained in:
parent
b6a5d8590c
commit
54ab9ad312
|
@ -677,10 +677,12 @@ unicode_result_ready(PyObject *unicode)
|
|||
if (kind == PyUnicode_1BYTE_KIND) {
|
||||
const Py_UCS1 *data = PyUnicode_1BYTE_DATA(unicode);
|
||||
Py_UCS1 ch = data[0];
|
||||
if (unicode != LATIN1(ch)) {
|
||||
PyObject *latin1_char = LATIN1(ch);
|
||||
if (unicode != latin1_char) {
|
||||
Py_INCREF(latin1_char);
|
||||
Py_DECREF(unicode);
|
||||
}
|
||||
return get_latin1_char(ch);
|
||||
return latin1_char;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue