STINNER Victor added the comment: Oh, here is in interesting commit: --- changeset: 33705:891042c94aed branch: legacy-trunk user: Tim Peters <tim.pet...@gmail.com> date: Sat Oct 09 22:33:09 2004 +0000 files: Python/thread.c description: Document the results of painful reverse-engineering of the "portable TLS" code.
PyThread_set_key_value(): It's clear that this code assumes the passed-in value isn't NULL, so document that it must not be, and assert that it isn't. It remains unclear whether existing callers want the odd semantics actually implemented by this function. --- Here is a patch adding a _PyThread_set_key_value() function which behaves as I expected. It looks like PyThread_set_key_value() got its strange behaviour from the find_key() of Python/thread.c. Don't hesistate if you have a better suggestion for the name if the new function :-) Another option is to modify directly the existing function, but it might break applications relying on the current (weird) behaviour. ---------- keywords: +patch nosy: +pitrou, tim.peters Added file: http://bugs.python.org/file32879/pythread_set_key_value.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19787> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com