Skip to content

Commit bec9c76

Browse files
Update 2026-04-10-16-19-23.gh-issue-148263.trqp3-.rst
1 parent 19a6fe7 commit bec9c76

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
Fix refcount leak in weakref proxy binary/ternary operations and
2-
proxy_richcompare: when unwrapping the second or third argument fails
3-
(dead proxy), the first argument's refcount was already incremented by
4-
a prior UNWRAP but never released. Introduces UNWRAP_OR(o, cleanup),
5-
which executes cleanup before returning NULL, allowing callers to
6-
release any previously acquired references on failure.
1+
Fix refcount leak in weakref proxy operations:
2+
When a weakref proxy was used in binary, ternary, or rich comparison operations
3+
and the second argument turned out to be a dead proxy, the first argument's
4+
reference count was already incremented by the unwrap step but never released,
5+
causing a memory leak.This patch replaces the old UNWRAP macro with
6+
a proper inline function _proxy_unwrap() that tracks whether each
7+
argument was incref'd, and introduces cleanup paths (goto clean_up)
8+
that correctly decref any already-acquired references before
9+
returning NULL on failure.

0 commit comments

Comments
 (0)