Skip to content
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

PY_NUMPY_BUFFER_FORMAT declared conditionally but used unconditionally #3

Open
umlaeute opened this issue Jun 7, 2021 · 2 comments

Comments

@umlaeute
Copy link

umlaeute commented Jun 7, 2021

in pybuffer.cpp, the PY_NUMPY_BUFFER_FORMAT is defined only if PY_NUMPY is already defined:

py/source/pybuffer.cpp

Lines 31 to 37 in 35138a0

# if defined(PY_NUMPY)
# include <numpy/arrayobject.h>
# if _FLEXT_NEED_SAMPLE_CONV
# define PY_NUMPY_BUFFER_FORMAT "f"
# else
# define PY_NUMPY_BUFFER_FORMAT "d"
# endif

but later on, it is used even if PY_NUMPY is not defined:

view->format = (flags & PyBUF_FORMAT) ? (char *) PY_NUMPY_BUFFER_FORMAT : NULL;

this obviously break the build if PY_NUMPY is not defined...

@grybouilli
Copy link

grybouilli commented Jun 29, 2023

I manage to build replacing the line
view->format = (flags & PyBUF_FORMAT) ? (char *) PY_NUMPY_BUFFER_FORMAT : NULL;
with

view->format = (flags & PyBUF_FORMAT) ? ((Py_buffer*)view)->format : NULL;

But I'm getting linking errors on loading the py.pd_linux external in puredata... (says symbol PyExc_ValueError is undefined even tho I make sure to link -lpython3 at build time...)

@grybouilli
Copy link

grybouilli commented Jun 29, 2023

But I'm getting linking errors on loading the py.pd_linux external in puredata... (says symbol PyExc_ValueError is undefined even tho I make sure to link -lpython3 at build time...)

Had to set rpath for better linking. Made a pull request for linking reinforcement and newer numpy versions support

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

No branches or pull requests

2 participants