jcrist · GitHub

@jcrist

This adds a new `weakref` config option for structs. If `True`,
instances of the struct type will support weakrefs. Defaults to False.
This also fixes a few subtle (and unlikely) bugs in the `Struct_dealloc`
implementation:
- Fixes a bug when deallocating long chains of Struct instances, which
requires trashcan support. Previously the freelist interactions were
done outside of the TRASHCAN macros, which was incorrect.
- Fixes a bug where `Struct` types with a `__del__` method and GC
support interacted poorly with the freelist, potentially causing reused
instances to fail to run their `__del__` method.

Read the original on github.com ↗