Skip to content

MAINT: Define Py_SETREF for pre-3.5.2 python and use in code #12155

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 1 commit into from
Oct 16, 2018

Conversation

eric-wieser
Copy link
Member

No description provided.

(op) = (op2); \
Py_DECREF(_py_tmp); \
} while (0)

Copy link
Member

Choose a reason for hiding this comment

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

We should make the backport explicit. Since Py_SETREF was added in 3.5.2 [0], this should have a #if PY_VERSION_HEX < 0x03050200 ... #else

[0] see CPython changeset 57a01d3a0ee and git tag --contains 57a01d3a0ee

@eric-wieser
Copy link
Member Author

Note that to use the upstream macro, we need tp have not defined Py_limited_API or whatever it's called. I don't know if we do that or not, and didn't want to address that in this PR

@mattip
Copy link
Member

mattip commented Oct 13, 2018

You can check #ifdef Py_SETREF, with a comment about 3.52 and Py_LIMITED_API

@eric-wieser
Copy link
Member Author

Went with your original suggestion after all - it turns out we don't use Py_LIMITED_API - which makes sense, as it didn't exist in python 2.7. We have enough version-specific #defines that we have no intention of having a single compiled numpy work against multiple python versions

@mattip mattip merged commit 9af9b14 into numpy:master Oct 16, 2018
@mattip
Copy link
Member

mattip commented Oct 16, 2018

Thanks Eric

@eric-wieser eric-wieser deleted the setref branch October 16, 2018 03:15
@mattip mattip changed the title MAINT: Move NPY_SETREF to somewhere more reusable MAINT: Define Py_SETREF for pre-3.5.2 python and use in code Oct 17, 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.

2 participants