8000 ENH: Add a `__dict__` to ufunc objects and allow overriding `__doc__` by mtsokol · Pull Request #27735 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Add a __dict__ to ufunc objects and allow overriding __doc__ #27735

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

Merged
merged 7 commits into from
Nov 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check ufunc's dict on creation
  • Loading branch information
mtsokol committed Nov 12, 2024
commit 60fb21835c9f4a32d9961197449230684138db99
5 changes: 5 additions & 0 deletions numpy/_core/src/umath/ufunc_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -4687,6 +4687,7 @@ PyUFunc_FromFuncAndDataAndSignatureAndIdentity(PyUFuncGenericFunction *func, voi
ufunc->core_signature = NULL;
ufunc->core_enabled = 0;
ufunc->obj = NULL;
ufunc->dict = NULL;
ufunc->core_num_dims = NULL;
ufunc->core_num_dim_ix = 0;
ufunc->core_offsets = NULL;
Expand Down Expand Up @@ -4772,6 +4773,10 @@ PyUFunc_FromFuncAndDataAndSignatureAndIdentity(PyUFuncGenericFunction *func, voi
}
}
ufunc->dict = PyDict_New();
if (ufunc->dict == NULL) {
Py_DECREF(ufunc);
return NULL;
}
/*
* TODO: I tried adding a default promoter here (either all object for
* some special cases, or all homogeneous). Those are reasonable
Expand Down
Loading
0