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

Support New TSS (Thread Specific Storage) API of Python 3.7 #1932

Closed
sonots opened this issue Oct 13, 2017 · 4 comments
Closed

Support New TSS (Thread Specific Storage) API of Python 3.7 #1932

sonots opened this issue Oct 13, 2017 · 4 comments
Milestone

Comments

@sonots
Copy link
Contributor

sonots commented Oct 13, 2017

TLS (Thread Local Storage) API will be deprecated as https://github.com/python/cpython/blob/731e18901484c75b60167a06a0ba0719a6d4827d/Include/pythread.h#L81-L92 and TSS (Thread Specific Storage) API is newly added as https://github.com/python/cpython/blob/731e18901484c75b60167a06a0ba0719a6d4827d/Include/pythread.h#L98-L142.
see also https://www.python.org/dev/peps/pep-0539/

pythread.pxd does not support it yet https://github.com/cython/cython/blob/31752522d88f03642fb9c17474135cb16d2fe474/Cython/Includes/cpython/pythread.pxd.

@scoder
Copy link
Contributor

scoder commented Oct 13, 2017

Pull request welcome.
This probably also means that we should update the TLS usage inside of Cython itself, specifically in the FastGil code in ModuleSetupCode.c.

@sonots
Copy link
Contributor Author

sonots commented Oct 13, 2017

Is there a way to use preprocessors like #if PY_VERSION_HEX >= 0x03070000 in pythread.pxd?

@scoder
Copy link
Contributor

scoder commented Oct 13, 2017

You don't have to. Just declare them there. Users will have to take care that they are only used when available.

That being said, it's probably possible to backport the API to older CPython versions by defining Py_tss_t as a simple struct containing an int as native key, and then using that as key value in the old TLS C-API. There is already lots of compatibility code in ModuleSetupCode.c, so it shouldn't hurt much to add it there.

@sonots
Copy link
Contributor Author

sonots commented Oct 31, 2017

fixed via #1939

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