Skip to content

Title: fix: FrozenConfigDict crashes with empty tuple before list (#61) - #74

Open
dcaayushd wants to merge 1 commit into
google:masterfrom
dcaayushd:fix/frozen-config-dict-empty-tuple-ordering
Open

dcaayushd wants to merge 1 commit into
google:masterfrom
dcaayushd:fix/frozen-config-dict-empty-tuple-ordering

Conversation

@dcaayushd

Copy link
Copy Markdown

Fixes #61
empty tuple before a list breaks FrozenConfigDict, reverse order works fine.

root cause: empty tuples are singletons in Python so id(()) is always
the same. when a second empty sequence hits _tuple_to_immutable, the
id is already in visit_map and it hits the assert.

fix: return early for empty tuples before touching visit_map since
theres nothing to iterate over anyway.

added a regression test for both orderings.

@google-cla

google-cla Bot commented May 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@dcaayushd

Copy link
Copy Markdown
Author

@mohitreddy1996 please take a look at this.

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.

Weird FrozenConfigDict creation issues with ordering and tuples/lists

1 participant