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.

Author vstinner
Recipients axh, brett.cannon, scoder, vstinner
Date 2015-09-18.11:34:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442576054.05.0.674723983218.issue25150@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2015-09-18 11:34:14vstinnersetrecipients: + vstinner, brett.cannon, scoder, axh
2015-09-18 11:34:14vstinnersetmessageid: <1442576054.05.0.674723983218.issue25150@psf.upfronthosting.co.za>
2015-09-18 11:34:14vstinnerlinkissue25150 messages
2015-09-18 11:34:13vstinnercreate