Repository navigation
Python: Preserve already-typed native function arguments - #14643
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit intoOct 26, 2026
Conversation
Daniel Peng (original4422)
temporarily deployed
to
github-app-auth
October 23, 2026 00:47 — with
GitHub Actions
Inactive
Daniel Peng (original4422)
temporarily deployed
to
github-app-auth
October 23, 2026 00:47 — with
GitHub Actions
Inactive
Contributor
Author
|
Jose Alvarez (@jpalvarezl), when convenient, could you review this Python fix for already-typed native function arguments? It preserves custom instances and subclasses while retaining Pydantic revalidation and built-in coercion. The local functions/kernel tests (306) and all 13 pre-commit hooks pass. Thank you! |
Contributor
Author
|
Eduard van Valkenburg (@eavanvalkenburg), when you have a chance, could you review this Python fix for preserving already-typed custom instances passed through |
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 26, 2026
This branch was previously 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.
Summary
Fixes #14642.
native argument parsing revalidate Pydantic models recursively parse lists + preserve existing custom-class instances (including subclasses) construct other valuesThis avoids constructor errors for two-field dataclasses and silent nesting for one-field dataclasses. Built-in coercion, dictionary construction and Pydantic revalidation stay intact.
Evidence
Kernel.invokeregression cases fail on main, covering ordinary/dataclass instances, subclasses, repeated calls, mixed lists and function-to-function values.After:
python -m pytest tests/unit/functions tests/unit/kernel— 306 passed, 0 skipped on macOS/Python 3.12.revalidate_instances="always", invalid-instance rejection and built-in integer coercion remain covered.pre-commit run --config python/.pre-commit-config.yaml --all-files— all 13 hooks pass, including Ruff check/format. The repository-locked mypy 1.19.1 reports no issues in all 556 package source files.Merge Danger
Door: two-way
Blast Radius: argument-parsing
Limited to preserving custom instances already accepted by their parameter type; no API signatures or generic/union handling change.