Skip to content

Fix ast.arguments kwonlydefaults stub name - #16992

Open
ashishdhillon wants to merge 1 commit into
python:mainfrom
ashishdhillon:fix/16980-ast-kwonlydefaults
Open

ashishdhillon wants to merge 1 commit into
python:mainfrom
ashishdhillon:fix/16980-ast-kwonlydefaults

Conversation

@ashishdhillon

Copy link
Copy Markdown

Fixes #16980. Agent used: Codex.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

spark (https://github.com/apache/spark)
+ python/pyspark/sql/transpile.py:1562: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/utilities/callables/__init__.py:772: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]
+ src/prefect/utilities/callables/__init__.py:773: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]
- src/prefect/utilities/callables/__init__.py:771: error: Incompatible types in assignment (expression has type "list[None]", variable has type "list[expr | None]")  [assignment]
- src/prefect/utilities/callables/__init__.py:771: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
- src/prefect/utilities/callables/__init__.py:771: note: Consider using "Sequence" instead, which is covariant
- src/prefect/utilities/callables/__init__.py:773: error: Unsupported operand types for + ("list[None]" and "list[expr | None]")  [operator]
- src/prefect/flows.py:3516: error: Incompatible types in assignment (expression has type "expr | None", variable has type "expr")  [assignment]
+ src/prefect/flows.py:3516: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]
+ src/prefect/flows.py:3543: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]

mypy (https://github.com/python/mypy)
+ mypy/fastparse.py:1107: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]

flake8-pyi (https://github.com/PyCQA/flake8-pyi)
+ flake8_pyi/visitor.py:1675: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]
+ flake8_pyi/visitor.py:2089: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/pycode/ast.py: note: In member "visit_arguments" of class "_UnparseVisitor":
+ sphinx/pycode/ast.py:86:51: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]
+ sphinx/ext/autodoc/_dynamic/_preserve_defaults.py: note: In function "update_default_value":
+ sphinx/ext/autodoc/_dynamic/_preserve_defaults.py:112:34: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]
+ sphinx/ext/autodoc/_dynamic/_preserve_defaults.py:121:28: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]
+ sphinx/ext/autodoc/_dynamic/_preserve_defaults.py: note: At top level:
+ sphinx/ext/autodoc/_dynamic/_preserve_defaults.py:136: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/util/inspect.py: note: In function "signature_from_ast":
+ sphinx/util/inspect.py:1007:46: error: "arguments" has no attribute "kw_defaults"; maybe "defaults" or "kwonlydefaults"?  [attr-defined]

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stdlib/ast.pyi: ast.arguments field and __init__ parameter should be kwonlydefaults, not kw_defaults

1 participant