]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-122420: Fix accounting for immortal interned strings in refleak.py (GH-122421)
authorSam Gross <colesbury@gmail.com>
Mon, 29 Jul 2024 22:15:03 +0000 (18:15 -0400)
committerGitHub <noreply@github.com>
Mon, 29 Jul 2024 22:15:03 +0000 (00:15 +0200)
The `_PyUnicode_Intern*` functions already adjust the total refcount, so
we don't want to readjust it in refleak.py.

Lib/test/libregrtest/refleak.py

index 20b05954c762ff8b03956dedfee91ec3566ac203..fa447a4336a3991990c44a1a9ff867a119fba59e 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)