Skip to content

fix: return empty tuple when protobuf not available#45466

Closed
Jah-yee wants to merge 1 commit intohuggingface:mainfrom
Jah-yee:fix/protobuf-decode-error-handling
Closed

fix: return empty tuple when protobuf not available#45466
Jah-yee wants to merge 1 commit intohuggingface:mainfrom
Jah-yee:fix/protobuf-decode-error-handling

Conversation

@Jah-yee
Copy link
Copy Markdown

@Jah-yee Jah-yee commented Apr 16, 2026

Fixes #45459 - Previously import_protobuf_decode_error() raised ImportError when protobuf wasn't installed even for other exceptions, hiding the real error. Now returns empty tuple () so the actual exception propagates.

…g ImportError

Previously, import_protobuf_decode_error() raised ImportError when protobuf
wasn't installed, even when the actual exception was a different type
(e.g., ValueError, RuntimeError). This caused the real error to be
hidden.

Now returns empty tuple () when protobuf is not available, so the except
clause matches nothing and allows the actual exception to propagate.
This matches the suggested fix in issue huggingface#45459.
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.

except import_protobuf_decode_error() hides real tokenizer errors when protobuf isn't installed

1 participant