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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee=Noneclosed_at=Nonecreated_at=<Date2021-04-23.03:30:06.398>labels= ['interpreter-core', 'type-feature', '3.10']
title='anext builtin docstring has no signature text or info about default argument'updated_at=<Date2021-06-22.21:01:15.946>user='https://github.com/eriknw'
The new builtin anext does not have a signature (from inspect.signature(anext)). This is expected, because inspect does not yet support signatures with C NULL default value. However, anext also doesn't have text in its docstring that describes its signature as is typical for builtins. This means help(anext) in the Python REPL gives no indication how to call the function. It should.
Thanks for taking a look Terry. I saw that error as well. It is separate from this issue, and I don't think it is a bug. No other builtin functions or methods that raise this error with this text have such a notice in their docstring, so it doesn't seem appropriate to me to add it to the docstring at this point in time.
Search for "" to find other functions and methods that have the same issue. dict.pop is one such example.
inspect.signature(anext) and inspect.signature(next) both raise ValueError. The text for next is what one may hope to see (and why you raise a fair point): "ValueError: no signature found for builtin <built-in function next>". The difference between anext and next in this regard is that anext uses the argument clinic. It is the argument clinic that converts NULL to "<unrepresentable>" in the signature text that inspect tries (and fails) to parse to get the AST of.
I actually did poke around a bit at having the the Argument Clinic and inspect module more intelligently pick up this case to give a better error. I think this is doable, but should not be part of this bug report.