Repository navigation
Conversation
Commit 15bc02e (PR python#14695 on GitHub [1]) added a type signature for the `postprocessor` Callable but failed to take into account that upstream has a feature where that Callable may return `None`, and upstream interprets that as “throw away the node entirely in post-processing.” See [2] and [3] in the upstream code. Relax the return value for `postprocessor` so instead of: ```py tuple[str, _AttrValue] ``` it can return `None`: ```py tuple[str, _AttrValue] | None ``` That way, clients can now use that feature again, just like they used to in types-xmltodict 0.15.0.20250907 and earlier. [1]: python#14695 [2]: https://github.com/martinblech/xmltodict/blob/v1.0.4/xmltodict.py#L93-L97 [3]: https://github.com/martinblech/xmltodict/blob/v1.0.4/xmltodict.py#L160-L162
Contributor
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
claui
marked this pull request as draft
October 25, 2026 22:58
This branch has not been deployed
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.
Overview
PR #14695 added a type signature for the
postprocessorCallable but failed to take into account that upstream has a feature where that Callable may returnNone, and upstream interprets that as “throw away the node entirely in post-processing.” That oversight caused a typechecking regression for all clients who are using this feature.This PR relaxes the return value for
postprocessorso instead of:it can return
Noneto declare that it wants the node gone:That way, clients can now use that feature again, just like they used to in types-xmltodict 0.15.0.20250907 and earlier.
Relevant upstream code
For reference, the “throw away this node” upstream feature is implemented here:
https://github.com/martinblech/xmltodict/blob/v1.0.4/xmltodict.py#L93-L97
https://github.com/martinblech/xmltodict/blob/v1.0.4/xmltodict.py#L160-L162
That feature has existed pre-1.0, and is still around today.