[go] weak: fix weak pointer test to correctly iterate over weak pointers after GC

0 views
Skip to first unread message

David Chase (Gerrit)

unread,
Dec 8, 2025, 5:39:39 PM (4 days ago) Dec 8
to shuang cui, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Dmitri Shuralyov, Dmitri Shuralyov, Michael Knyszek, Go LUCI, golang-co...@googlegroups.com

David Chase submitted the change

Change information

Commit message:
weak: fix weak pointer test to correctly iterate over weak pointers after GC

This change fixes a bug in the weak pointer test where the loop was
attempting to iterate over a nil slice (bt) instead of the weak
pointer slice (wt).

After setting bt to nil and running GC, the test should iterate over
the weak pointers to verify they've been cleared, not attempt to
iterate over the now-nil strong references.
Change-Id: Ic0425f59da132257770ed87d1bcea5d2c0a54e07
Reviewed-by: David Chase <drc...@google.com>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Reviewed-by: Sean Liao <se...@liao.dev>
Files:
  • M src/weak/pointer_test.go
Change size: XS
Delta: 1 file changed, 1 insertion(+), 1 deletion(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by David Chase, +2 by Sean Liao, +1 by Dmitri Shuralyov
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ic0425f59da132257770ed87d1bcea5d2c0a54e07
Gerrit-Change-Number: 723600
Gerrit-PatchSet: 4
Gerrit-Owner: shuang cui <imc...@gmail.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Sean Liao <se...@liao.dev>
Gerrit-Reviewer: shuang cui <imc...@gmail.com>
Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-CC: Michael Knyszek <mkny...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages