Skip to content

SChunk.meta.get: Fix infinite recursion#681

Open
Zentrik wants to merge 2 commits into
Blosc:mainfrom
Zentrik:patch-1
Open

SChunk.meta.get: Fix infinite recursion#681
Zentrik wants to merge 2 commits into
Blosc:mainfrom
Zentrik:patch-1

Conversation

@Zentrik

@Zentrik Zentrik commented Jul 23, 2026

Copy link
Copy Markdown

Fixes #679

@Zentrik

Zentrik commented Jul 23, 2026

Copy link
Copy Markdown
Author

I guess I should add a test

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the SChunk.meta.get() implementation in src/blosc2/schunk.py to avoid infinite recursion (Issue #679), restoring correct Mapping.get-style behavior for fixed-length metadata access on SChunk.

Changes:

  • Replace the recursive Meta.get() implementation with a non-recursive lookup that returns default for missing keys.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/blosc2/schunk.py Outdated
Comment thread src/blosc2/schunk.py Outdated
Comment on lines +154 to +157
def get(self, key: str, default: Any = None) -> Any:
"""Return the value for `key` if `key` is in the dictionary, else return `default`.
If `default` is not given, it defaults to ``None``."""
return self.get(key, default)
return self[key] if key in self else default
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

SChunk.meta.get infinitely recurses

2 participants