Message304697
| Author |
ncoghlan |
| Recipients |
masamoto, ncoghlan, scoder |
| Date |
2017年10月21日.08:07:56 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1508573276.8.0.213398074469.issue31828@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Right, the cases we were aiming to cover were:
- C variable declarations ("static Py_tss_t tss_key = Py_tss_NEEDS_INIT;")
- dynamic allocation with PyThread_tss_alloc
- resetting a key back to the uninitialised state with PyThread_tss_delete
The problem we have is that the second field in Py_tss_t is platform dependent, and not all platforms define a safe "unused" value for their NATIVE_TSS_KEY_T, which means Py_tss_NEEDS_INIT ends up being only a partial initialiser (earlier versions of the PEP used a field initialiser, but we were asked to switch it to a partial initialiser in order to support more compilers).
We *could* offer a `PyThread_tss_reset` (to reset a key back to Py_tss_NEEDS_INIT), but that's confusingly similar to PyThread_tss_delete.
Another option would be to check for typed partial initialiser support in the configure script, and declare Py_tss_NEEDS_INIT accordingly. However, that wouldn't solve the problem for any clients that are themselves also attempting to write cross-platform code. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年10月21日 08:07:56 | ncoghlan | set | recipients:
+ ncoghlan, scoder, masamoto |
| 2017年10月21日 08:07:56 | ncoghlan | set | messageid: <1508573276.8.0.213398074469.issue31828@psf.upfronthosting.co.za> |
| 2017年10月21日 08:07:56 | ncoghlan | link | issue31828 messages |
| 2017年10月21日 08:07:56 | ncoghlan | create |
|