This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use Py_uintptr_t instead of void* for atomic pointers
Type: Stage:
Components: Interpreter Core Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, John.Malmberg, Vitor.de.Lima, fijall, gustavotemple, koobs, lbianc, neologix, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2016-01-20 10:57 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
atomic_pointer.patch vstinner, 2016-01-20 10:58 review
Messages (4)
msg258661 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-01-20 10:57
Attached patch fixes compiler warnings on atomic pointers.

Python has 4 implementations of atomic types:

* <stdatomic.h>
* GCC 4.7+ builtin atomic operations
* GCC x86 and x86_64 assembler
* volatile

The type of atomic pointers changes depending on the implementation. Attached patch changes the _Py_atomic_address to use atomic_uintptr_t (<stdatomic.h>) or Py_uintptr_t type internally.

The patchs also adds GET_TSTATE(), SET_TSTATE() and GET_INTERP_STATE() macros in pystate.c to make the code more readable.

This issue is a follow up of the issue #22038 which added support for <stdatomic.h> in Python/pyatomic.h. See also issues #23644 (compilation issue with g++), #25150 (compilation issue with OpenMP) and #26154 (add _PyThreadState_UncheckedGet()).

I would be "nice" to backport this change to Python 3.5.2 to fix the compiler warning, but I'm not 100% confident that my patch works on all compilers and all platforms. Maybe it's better to "experiment" it only in Python 3.6.

Note: I copied the nosy list of the issue #22038 since this one is a follow up.
msg258662 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-01-20 10:58
(Oops, I attached the wrong patch. It's now fixed.)
msg258800 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-22 13:13
New changeset ff68ffcc6244 by Victor Stinner in branch 'default':
Use Py_uintptr_t for atomic pointers
https://hg.python.org/cpython/rev/ff68ffcc6244
msg262412 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-25 09:11
New changeset b1666037c97e by Victor Stinner in branch '3.5':
Use Py_uintptr_t for atomic pointers
https://hg.python.org/cpython/rev/b1666037c97e
History
Date User Action Args
2022-04-11 14:58:26adminsetgithub: 70349
2019-01-15 01:21:57cheryl.sabellalinkissue26410 superseder
2016-03-25 09:11:26python-devsetmessages: + msg262412
2016-01-22 13:14:09vstinnersetstatus: open -> closed
resolution: fixed
2016-01-22 13:13:54python-devsetnosy: + python-dev
messages: + msg258800
2016-01-20 10:58:39vstinnersetfiles: + atomic_pointer.patch

messages: + msg258662
2016-01-20 10:57:33vstinnersetfiles: - atomic_pointer.patch
2016-01-20 10:57:13vstinnercreate