-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
DOC: Fix some out-of-data struct in c-api types-and-structures #27582
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
base: main
Are you sure you want to change the base?
Conversation
Hi, This is my first time submitting a pull request on GitHub, and I apologize for any mistakes made. I added Could someone guide me on how to properly use Thank you for your help! |
You need to include |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! It's easy to lose the forest for the trees when we're working on the C API and forget to update the docs.
Sorry! That was me being careless and misunderstanding. I thought this was referring to the |
If you are referring to |
I agree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice tweak of the c docs. I had a few small suggestions, what do you think?
|
||
An implementation detail for accessing the :c:data:`PyArrayObject` struct. | ||
You should use :c:data:`PyArrayObject` to ensure code compatibility and stability. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should document this internal struct in the documentation of public structures. We hid it on purpose. We could have internal documentation that could document this and other structs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you referring to PyArrayObject_fields? While it's true that this internal struct is not part of the public API, it can still be accessed via:
#include <numpy/arrayobject.h>
int main() {
PyArrayObject_fields * a;
}
Given that it can be accessed, I believe it might be helpful to at least provide some guidance to users. We could mention its existence with a clear note advising against direct usage, and suggest the appropriate alternatives that should be used instead. This way, users are informed without inadvertently encouraging misuse of internal structures.
close/reopen |
DOC: Update C-API docs
PyArrayObject
toPyArrayObject_fields
.mem_handler
and_buffer_info
.PyArray_Descr
metadata field and addednpy_hash_t
documentation.PyArray_ArrFuncs
andPyUFuncObject
.[skip azp] [skip actions] [skip cirrus]