Repository navigation
Give ShapeSerializer.flush an explicit no-op body - #1018
Open
jonathan343 wants to merge 2 commits into
Open
jonathan343 wants to merge 2 commits into
jonathan343 wants to merge 2 commits into
Conversation
jonathan343
marked this pull request as ready for review
December 6, 2026 07:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Stacked on #1017, targeting
chore/add-pyreflyso this PR contains only theflushfix. I will retarget todevelopafter #1017 merges.Summary
ShapeSerializer.flushhas only a docstring for its body. At runtime that makes it a no-op default, and 31 of the 36 serializers in this repo rely on it, includingSpecificShapeSerializerandInterceptingSerializer. Type checkers read a protocol method with an empty body as abstract instead. mypy and pyrefly therefore reject any serializer that inheritsflushwithout overriding it, both here and in user code that subclasses these base classes. Pyright doesn't apply this rule, so CI never reported it.This gives
flushareturn Nonebody and documents the default in its docstring, the same wayIdentityResolver.invalidateandAuthScheme.event_signerdo.passand...count as empty bodies, so they would not fix it. Runtime behavior is unchanged. The fix removes 68 of the 162 entries inpyrefly-baseline.json.Before / After
Before (mypy 2.4.1, then pyrefly 1.5.2)
After
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.