Repository navigation
Implement gc methods (traverse, clear) for immutable objects #5694
Answered
by
davidhewitt
MatthieuDartiailh
asked this question in
Questions
|
Hi, I have a use case where a frozen object need to store a reference to a Python objects (Option<HashMap<String, Py>>). Because I store a Python object, I believe I should implement the equivalent of tp_traverse and tp_clear. However since the object is frozen I cannot get a mutable reference and hence implement clear. Is this a case where one can skip those implementation and if not how can I implement clear ? |
Answered by
davidhewitt
Dec 19, 2025
Replies: 1 comment 1 reply
|
You can skip |
1 reply
Answer selected by
MatthieuDartiailh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can skip
tp_clearon immutable objects. (Presumably to create a cycle, some other part of the chain must be mutable, and that part should implementtp_clear.)