Message250964
> Would there be a way to expose these internals rather than hiding them?
Here is the issue is that pyatomic.h cannot be compiled on OpenMP. We had the same issue with C++. In fact, it doesn't make sense to compile pyatomic.h differently to access an atomic variable from an extension module. We must always use exactly the same implementation, otherwise bad things will happen.
A solution for that is to hide the implementation details and only expose high level APIs.
For example, pyatomic.h must be completly hidden.
A consequence is that the _PyThreadState_Current variable must be hidden to. _PyThreadState_Current is an implementation detail, you must not access it directly.
The PyThreadState_GET() macro uses directly the _PyThreadState_Current variable. So the solution to expose the "PyThreadState_GET" symbol (not necessary as a macro) is to define it as an alias to the PyThreadState_Get() *function*.
The advantage of using a function is that we don't expose implementation details to third-party extensions, it avoids the risk of ABI incompatibilies. |
|
Date |
User |
Action |
Args |
2015-09-18 11:34:14 | vstinner | set | recipients:
+ vstinner, brett.cannon, scoder, axh |
2015-09-18 11:34:14 | vstinner | set | messageid: <1442576054.05.0.674723983218.issue25150@psf.upfronthosting.co.za> |
2015-09-18 11:34:14 | vstinner | link | issue25150 messages |
2015-09-18 11:34:13 | vstinner | create | |
|