From 92ecb622b1020b9efa0435726bf018a9575f1c4a Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 10 Mar 2022 18:21:32 -0800 Subject: [PATCH] bpo-46881: Fix refleak from GH-31616 @FidgetSpinner found the leak and the patch but asked me to submit it. Confirmed that this fixes the leak with ./python.exe -m test test_sax -R 3:2 --- Objects/unicodeobject.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 9052c53f11b8e2..2261b9a0316259 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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; } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy