]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-122420: Fix accounting for immortal interned strings in refleak.py (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 30 Jul 2024 07:36:08 +0000 (09:36 +0200)
committerGitHub <noreply@github.com>
Tue, 30 Jul 2024 07:36:08 +0000 (09:36 +0200)
The `_PyUnicode_Intern*` functions already adjust the total refcount, so
we don't want to readjust it in refleak.py.
(cherry picked from commit ac8da34621a574cd5773217404757a294025ba49)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Lib/test/libregrtest/refleak.py

index d2fab19c9a19326468c5dc9875ddf5a5e2198a07..ff811ee0a4a9c2998cef2b1f669cd6e4dd96d464 100644 (file)
@@ -145,7 +145,7 @@ def runtest_refleak(test_name, test_func,
             # Use an internal-only keyword argument that mypy doesn't know yet
             _only_immortal=True)  # type: ignore[call-arg]
         alloc_after = getallocatedblocks() - interned_immortal_after
-        rc_after = gettotalrefcount() - interned_immortal_after * 2
+        rc_after = gettotalrefcount()
         fd_after = fd_count()
 
         rc_deltas[i] = get_pooled_int(rc_after - rc_before)