You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Autoreload: disabled positonal arguments cannot change their default #14145
$ ipython --profile=default
%load_ext autoreload
%autoreload 3
with open('tmp.py', 'w') as f:
f.write('def f(*, a=1): return a')
import tmp
print(tmp.f())
with open('tmp.py', 'w') as f:
f.write('def f(*, a=2): return a')
print(tmp.f())
Actual Output
Python 3.6.9 (default, Nov 25 2022, 14:10:45)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
1
1
func_attrs = [
"__code__",
"__defaults__", # <<<<< regular keyword arguments go here
"__doc__",
"__closure__",
"__globals__",
"__dict__",
"__kwdefaults__", # <<<<<<<<<<< just add this line to "IPython/extensions/autoreload.py#L282"
]
Activity
Carreau commentedon Aug 28, 2023
Would you be willing to send a PR with the fix, and maybe a test to make sure there is no regressions ?