Skip to content

Conversation

@hoodmane
Copy link
Contributor

@hoodmane hoodmane commented Aug 28, 2022

PyUFuncGenericFunction has type void (*)(char **, const npy_intp *, const npy_intp *, void *), so dimensions and steps should be const. Otherwise compiling with -Wincompatible-function-pointer-types will fail:

src/_ufuncs.c:54:46: error: incompatible function pointer types initializing 'PyUFuncGenericFunction' (aka 'void (*)(char **, const long *, const long *, void *)') with an expression of type 'void (*)(char **, npy_intp *, npy_intp *, void *)' (aka 'void (*)(char **, long *, long *, void *)') [-Wincompatible-function-pointer-types]
static PyUFuncGenericFunction funcs_d_d[] = {&loop1d_d_d};

https://app.circleci.com/pipelines/github/hoodmane/pyodide/3783/workflows/3c5fdd0d-baf9-41b7-8dc8-56511ba2fdc0/jobs/45949

Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

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

Thank you, good idea.
https://numpy.org/doc/stable/reference/c-api/ufunc.html#c.PyUFuncGenericFunction shows the order as int const *x rather than the presumably equivalent const int *x. Is there a reason you chose the second form rather than matching the docs and ufuncobject.h?

@hoodmane
Copy link
Contributor Author

No reason. It is indeed probably better to be consistent, I will switch it.

@hoodmane
Copy link
Contributor Author

Should I squash commits?

@efiring efiring merged commit 652312a into TEOS-10:master Aug 28, 2022
@efiring
Copy link
Member

efiring commented Aug 28, 2022

I just used the "squash and merge" option of the merge button...
Thank you for the PR.

hoodmane added a commit to pyodide/pyodide that referenced this pull request Aug 30, 2022
ocefpaf added a commit to ocefpaf/GSW-Python that referenced this pull request Oct 13, 2022
efiring added a commit to efiring/GSW-Python that referenced this pull request Oct 13, 2022
This replaces TEOS-10#99 by putting the change in the code generator, not just
in the generated code.
@efiring
Copy link
Member

efiring commented Oct 13, 2022

It turns out this was missing a critical element: the change in the code generator, tools/make_ufuncs.py.
This is fixed by #109.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants