Erik Bray writes: > Abstract > ======== > > The proposal is to add a new Thread Local Storage (TLS) API to CPython > which would supersede use of the existing TLS API within the CPython > interpreter, while deprecating the existing API.
Thank you for the analysis! Question: > Further, the old PyThread_*_key* functions will be marked as > deprecated. Of course, but: > Additionally, the pthread implementations of the old > PyThread_*_key* functions will either fail or be no-ops on > platforms where sizeof(pythead_t) != sizeof(int). Typo "pythead_t" in last line. I don't understand this. I assume that there are no such platforms supported at present. I would think that when such a platform becomes supported, code supporting "key" functions becomes unsupportable without #ifdefs on that platform, at least directly. So you should either (1) raise UnimplementedError, or (2) provide the API as a wrapper over the new API by making the integer keys indexes into a table of TSS'es, or some such device. I don't understand how (3) "make it a no-op" can be implemented for PyThread_create_key -- return 0 or -1? That would only work if there's a failure return status like 0 or -1, and it seems really dangerous to me since in general a lot of code doesn't check status even though it should. Even for code checking the status, the error message will be suboptimal ("creation failed" vs. "unimplemented"). I gather from references to casting pthread_key_t to unsigned int and back that there's probably code that does this in ways making (2) too dangerous to support. If true, perhaps that should be mentioned here. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/