SIGN IN SIGN UP

gh-94207: Fix struct module leak (GH-94239) (GH-94265)

Make _struct.Struct a GC type

This fixes a memory leak in the _struct module, where as soon
as a Struct object is stored in the cache, there's a cycle from
the _struct module to the cache to Struct objects to the Struct
type back to the module. If _struct.Struct is not gc-tracked, that
cycle is never collected.

This PR makes _struct.Struct GC-tracked, and adds a regression test.
(cherry picked from commit 6b865349aae47b90f9ef0b98f3fe3720c2f05601)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
M
Miss Islington (bot) committed
4bc5f9fe8cd44010c9919207cefdcb3e08606044
Parent: 89ba660
Committed by GitHub <noreply@github.com> on 6/25/2022, 2:40:14 PM