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

BUG: f2py: fix f2py generated code to work on Pypy #10657

Merged
merged 1 commit into from Feb 24, 2018

Conversation

pv
Copy link
Member

@pv pv commented Feb 24, 2018

F2py generates code that uses PyTuple_SetItem on a tuple that has been
"used", which is invalid on Pypy.

Add #ifdefs that make the generated code convert the object to a list,
use PyList_SetItem, and then convert it back to a tuple before it is used and use it
as an argument list in a function call.

This enables scipy.linalg tests to pass on pypy. There is no change of behavior on non-pypy.

F2py generates code that uses PyTuple_SetItem on a tuple that has been
"used", which is invalid on Pypy.

Add #ifdefs that make the generated code convert the object to a list,
use PyList_SetItem, and then convert it back to a tuple.
#ifdef PYPY_VERSION
\tcapi_return = PyObject_CallObject(#name#_capi,(PyObject *)capi_arglist_list);
\tPy_DECREF(capi_arglist_list);
\tcapi_arglist_list = NULL;
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, in case there's a jump to capi_fail below.

Copy link
Member

Choose a reason for hiding this comment

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

A tangled web we weave :)

@charris
Copy link
Member

charris commented Feb 24, 2018

We should really replace the \t with spaces at some point, it make the code so much more readable.

@charris charris added this to the 1.14.2 release milestone Feb 24, 2018
@charris charris merged commit d71b17d into numpy:master Feb 24, 2018
@charris
Copy link
Member

charris commented Feb 24, 2018

Thanks Pauli.

@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Mar 11, 2018
@charris charris removed this from the 1.14.2 release milestone Mar 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants