-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help text of builtin functions – missing signatures #107526
Comments
Yes, this is because of
|
Is there any way to fix it? |
I've submitted https://discuss.python.org/t/ac-null-defaults-prevent-correct-signatures-lets-add-inspect-unrepresentable-to-fix-this/30753 I wanted to do it for quite a long time, sorry for ignoring this item in my backlog :) |
Is this feasible for 3.11? FWIW, this breaks Jedi, which currently parses the manually-formatted signatures in docstrings: davidhalter/jedi#1952 |
I will send a PR with doc-based signatures later today. Today I broke a Jedi! The force is strong in me 😆 |
I meant 3.12, not 3.11. Got my version numbers mixed up, sorry! |
The fix @sobolevn proposes doesn't seem feasible for 3.12, as it requires introducing a new object in the |
@JelleZijlstra that's exactly what I am proposing for 3.11 and 3.12 in #107526 (comment) :) |
Ok, I think that we would need to revert these changes. Here's why:
/*[clinic input]
dir as builtin_dir
arg: object = NULL
/
dir([object]) -> list of strings
Show attributes of an object.
...
[clinic start generated code]*/
static PyObject *
builtin_dir_impl(PyObject *module, PyObject *arg)
/*[clinic end generated code: output=24f2c7a52c1e3b08 input=2e2cb290445c88f3]*/ outputs: PyDoc_STRVAR(builtin_dir__doc__,
"dir($module, arg=<unrepresentable>, /)\n"
"--\n"
"\n"
"dir([object]) -> list of strings\n"
"\n"
"Show attributes of an object.\n"
"\n"
"..."); But, that's not what we want!
|
…n bltinsmodule to AC"
FYI I don't think the effects on Jedi are extreme (speaking as its author). It's just that it's a bit unfortunate that the signatures won't be shown anymore in that case for 3.12. So yes, it's a regression, but not a problematic regression. So if argument clinic helps you here with other issues, it might just be worth keeping it. IMO the more problematic change here might be that the docstrings are just not as good as they were previously. Especially for In the end it would be really nice if these functions were eventually supported by |
#107782 can help. |
The immediate issue was fixed here. We still have the broader issue that |
I don't understand the deep details here but I think something went wrong in commit bdfb694 when some of the builtin functions where transferred to argument clinic.
The problem I see is in the help texts of those functions. Here are a few examples of
help(<function>)
:iter
Python 3.11.4
Python 3.12.0b4
As you can see, the help in 3.12 is talking about two forms but there are no signatures so it doesn't make sense.
next
Python 3.11.4
Python 3.12.0b4
Again, the help text talks about
iterator
anddefault
but missing signature means that the reader might not know what those are.getattr
Python 3.11.4
Python 3.12.0b4
Again, a similar case here.
Linked PRs
The text was updated successfully, but these errors were encountered: