Skip to content

[protobuf] Fix internal decoder factory signatures - #16250

Open
ekanshul wants to merge 1 commit into
python:mainfrom
ekanshul:protobuf-decoder-factories
Open

[protobuf] Fix internal decoder factory signatures#16250
ekanshul wants to merge 1 commit into
python:mainfrom
ekanshul:protobuf-decoder-factories

Conversation

@ekanshul

Copy link
Copy Markdown

Closes #10697
Closes #10698
Closes #10712

Type the numeric XxxDecoder names as factories with the same signature as EnumDecoder (mirroring the encoder fix in #16163), make _Decoder and ReadTag take a memoryview, and let _NewDefault return Any, matching the runtime.

Agent used: Claude Code

At runtime Int32Decoder through BoolDecoder are factories with the same
signature as EnumDecoder (field_number, is_repeated, is_packed, key,
new_default, clear_if_default=False), not decoders. The returned
decoders and ReadTag receive a memoryview (ReadTag calls .tobytes()),
and new_default callables return scalars or containers, not Message.
Mirrors the encoder.pyi fix in python#16163.

Closes python#10697
Closes python#10698
Closes python#10712

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant