fix: add __kwdefaults__, __annotations__, __type_params__ to autorelo… by sid0229 · Pull Request #15274 · ipython/ipython · GitHub
Skip to content

fix: add __kwdefaults__, __annotations__, __type_params__ to autorelo…#15274

Open
sid0229 wants to merge 1 commit into
ipython:mainfrom
sid0229:fix/autoreload-missing-func-attrs
Open

fix: add __kwdefaults__, __annotations__, __type_params__ to autorelo…#15274
sid0229 wants to merge 1 commit into
ipython:mainfrom
sid0229:fix/autoreload-missing-func-attrs

Conversation

@sid0229

@sid0229 sid0229 commented Jun 26, 2026

Copy link
Copy Markdown

…ad func_attrs

Fixes #14968

autoreload's update_function() was not patching kwdefaults, annotations, or type_params when reloading a changed function. This meant that after editing a module, keyword-only argument defaults, type annotations, and PEP 695 type params would remain stale until the session was restarted.

kwdefaults and annotations are patched unconditionally; type_params (Python 3.12+, PEP 695) is handled safely by the existing try/except (AttributeError, TypeError) in update_function().

…ad func_attrs

Fixes ipython#14968

autoreload's update_function() was not patching __kwdefaults__,
__annotations__, or __type_params__ when reloading a changed function.
This meant that after editing a module, keyword-only argument defaults,
type annotations, and PEP 695 type params would remain stale until the
session was restarted.

__kwdefaults__ and __annotations__ are patched unconditionally;
__type_params__ (Python 3.12+, PEP 695) is handled safely by the
existing try/except (AttributeError, TypeError) in update_function().
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.

autoreload should also update __annotations__, __type_params__, and __kwdefaults__ for functions

1 participant