-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deserialization for str unions (#1239)
**Pull Request Checklist** - [ ] Fixes #<!--issue number goes here--> - [X] Tests added - [ ] Documentation/examples added - [X] [Good commit messages](https://cbea.ms/git-commit/) and/or PR title **Description of PR** PR #1168 changed the logic of `map_runner_input` and `_parse` to no longer pass incoming values to `json.loads` if their annotated type was a union that included str, rather than only when given a subtype of `Optional[str]`. This makes it impossible to, for instance, pass an int to a `Union[str, int]`. This PR splits `origin_type_issubclass` into two functions, `origin_type_issupertype` (which matches the previous behaviour) and `origin_type_issubtype`, and use the latter instead to restore the original behaviour. Additionally, it fixes a bug where we were passing an annotation to `issubclass` without first checking if it's a type, resulting in a `TypeError` (partially addresses #1173). --------- Signed-off-by: Alice Purcell <alicederyn@gmail.com>
- Loading branch information
1 parent
30cb592
commit 7df9b8e
Showing
7 changed files
with
97 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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