8000 ENH: add identity kwarg to frompyfunc by mattharrigan · Pull Request #8255 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: add identity kwarg to frompyfunc #8255

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 4 commits into from
Jan 17, 2020
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
Update umathmodule.c
  • Loading branch information
eric-wieser authored Dec 4, 2019
commit ecca72e069008af6c36c2dcd64201a4ecc141a1a
6 changes: 3 additions & 3 deletions numpy/core/src/umath/umathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) {
Py_ssize_t fname_len = -1;
void * ptr, **data;
int offset[2];
int identity = PyUFunc_None;
PyObject *identity = NULL; /* note: not the same semantics as Py_None */
static char *kwlist[] = {"", "nin", "nout", "identity", NULL};

if (!PyArg_ParseTupleAndKeywords(args, kwds, "Oii|$i:frompyfunc", kwlist,
if (!PyArg_ParseTupleAndKeywords(args, kwds, "Oii|$O:frompyfunc", kwlist,
&function, &nin, &nout, &identity)) {
return NULL;
}
Expand Down Expand Up @@ -150,7 +150,7 @@ ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) {

self = (PyUFuncObject *)PyUFunc_FromFuncAndDataAndSignatureAndIdentity(
(PyUFuncGenericFunction *)pyfunc_functions, data,
types, /* ntypes */ 1, nin, nout, PyUFunc_IdentityValue,
types, /* ntypes */ 1, nin, nout, identity ? PyUFunc_IdentityValue : PyUFunc_None,
str, doc, /* unused */ 0, NULL, identity);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A future PR could add signature, which would help vectorize


if (self == NULL) {
Expand Down
0