Skip to content

fix: check field type via C++ schema in from_dict to avoid a reference create - #407

Merged
haata merged 1 commit into
capnproto:masterfrom
greatgitsby:from-dict-schema-cycle
Sep 22, 2026
Merged

haata merged 1 commit into
capnproto:masterfrom
greatgitsby:from-dict-schema-cycle

Conversation

@greatgitsby

Copy link
Copy Markdown
Contributor

from_dict called self.schema.fields for str values, which builds _StructSchemaField wrappers that reference the schema, so every message built via kwargs stayed alive until a GC pass. Follow-up to #401, which only skipped the lookup for non-str values.

@greatgitsby greatgitsby changed the title fix: check field type via C++ schema in from_dict to avoid a referenc… fix: check field type via C++ schema in from_dict to avoid a reference create Sep 7, 2026
@greatgitsby
greatgitsby force-pushed the from-dict-schema-cycle branch from 991a4b4 to af1d012 Compare September 7, 2026 16:35
…e cycle

from_dict called self.schema.fields for str values, which builds
_StructSchemaField wrappers that reference the schema, so every
message built via kwargs stayed alive until a GC pass. Follow-up to
capnproto#401, which only skipped the lookup for non-str values.
@greatgitsby
greatgitsby force-pushed the from-dict-schema-cycle branch from af1d012 to e98ed61 Compare September 7, 2026 16:35
@greatgitsby

Copy link
Copy Markdown
Contributor Author

lint seems to fail on my machine and CI, unrelated to this commit.

@haata
haata merged commit a0cb5cd into capnproto:master Sep 22, 2026
11 of 12 checks passed
@haata

haata commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Thanks! Sorry for the delay.

@greatgitsby
greatgitsby deleted the from-dict-schema-cycle branch September 22, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants