Repository navigation
BUG: Default decode_parms to a DictionaryObject - #3971
Merged
stefan6419846 merged 2 commits intoAug 19, 2026
Merged
Conversation
`decode_stream_data` defaults the per-filter decode parameters to
`({},) * len(filters)`. The decoders take
`Optional[Union[DictionaryObject, IndirectObject]]`, and a plain `{}` is
not a `DictionaryObject`, so any stream without an explicit
`/DecodeParms` hands them the wrong type. A runtime protocol check
rejects it; static checking never noticed because the value flows
through `stream.get`, which returns `Any`.
`DictionaryObject()` is an empty mapping and satisfies the annotation, so
the substitution is behaviour-neutral. The same pattern is already used a
few lines above in `decode`.
Accounts for 5 of the failures in test_generic under `make testtype`;
they go to 0. Added a test that fails on main.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3971 +/- ##
=======================================
Coverage 97.94% 97.94%
=======================================
Files 57 57
Lines 11031 11031
Branches 2065 2065
=======================================
Hits 10804 10804
Misses 126 126
Partials 101 101 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
stefan6419846
requested changes
Aug 17, 2026
mock.patch.object on FlateDecode.decode replaces the custom subclass, and the call args carry what the decoder received.
Contributor
Author
|
Dropped the comment, and swapped the custom subclass for mock.patch.object on On whether it's needed at all: I'd lean towards keeping it. If the default goes |
stefan6419846
approved these changes
Aug 19, 2026
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.
decode_stream_datadefaults the per-filter decode parameters to({},) * len(filters). The decoders takeOptional[Union[DictionaryObject, IndirectObject]], and a plain{}is nota DictionaryObject, so any stream without an explicit /DecodeParms hands
them the wrong type. A runtime protocol check rejects it; static checking
never noticed because the value flows through
stream.get, which returns Any.DictionaryObject()is an empty mapping and satisfies the annotation, so thesubstitution is behaviour-neutral — the same pattern is already used a few
lines above in
decode.Accounts for 5 of the failures in test_generic under
make testtype; they goto 0. Added a test that fails on main.