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
dtype missing docstrings since 1.20.1 #18740
Comments
Its a bug in numpy/numpy/core/src/multiarray/compiled_base.c Lines 1428 to 1431 in c9c911e
That code can't cope with the fact that |
@seberg Did you make a fix for this? |
no, not yet. EDIT: are you preparing another release already? |
Hmm, I am trying to look at it, but it turns out a bit more complicated. Normally, Now, I can just set Although, I now see that we never added the |
This ensures that `help(np.dtype)` produces a result. I am not exactly sure why it picks up `__doc__` from the dict instead of `tp_doc` right now. It probably is due to the combination of inheritance and the fact that the dict always includes `None` and gets preference during inheritance. (That probably makes a lot of sense to not inherit the `type` docstring by default.) Modifying the dictionary directly is not really good style, either, but hopefully works. Closes numpygh-18740
Going to push this off to 1.22.0 for tracking. If there is a fix, we can backport to 1.21.x. |
+1 for a fix. (This is also a case where I--I mean, someone--would prefer a language with stricter typing, where a |
This ensures that `help(np.dtype)` produces a result. I am not exactly sure why it picks up `__doc__` from the dict instead of `tp_doc` right now. It probably is due to the combination of inheritance and the fact that the dict always includes `None` and gets preference during inheritance. (That probably makes a lot of sense to not inherit the `type` docstring by default.) Modifying the dictionary directly is not really good style, either, but hopefully works. Closes numpygh-18740
If someone wants a fix, they may want to review gh-18775 ;)
I seem to recall that even Python enforces stricter typing for bools occasionally, so there might be arguments to be made in certain cases at least. |
…18775) * DOC: Ensure that we add documentation also as to the dict for types This ensures that `help(np.dtype)` produces a result. I am not exactly sure why it picks up `__doc__` from the dict instead of `tp_doc` right now. It probably is due to the combination of inheritance and the fact that the dict always includes `None` and gets preference during inheritance. (That probably makes a lot of sense to not inherit the `type` docstring by default.) Modifying the dictionary directly is not really good style, either, but hopefully works. Closes gh-18740
This ensures that `help(np.dtype)` produces a result. I am not exactly sure why it picks up `__doc__` from the dict instead of `tp_doc` right now. It probably is due to the combination of inheritance and the fact that the dict always includes `None` and gets preference during inheritance. (That probably makes a lot of sense to not inherit the `type` docstring by default.) Modifying the dictionary directly is not really good style, either, but hopefully works. Closes numpygh-18740
Reproducing code example:
Error message:
None
Expected:
NumPy/Python version information:
import sys, numpy; print(numpy.version, sys.version)
1.20.1 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)]
The text was updated successfully, but these errors were encountered: