From 441adb8c5782de6fcf71ee3396d114c48cd1cb5b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 13 Dec 2013 04:14:41 +0100 Subject: Backout changeset 46393019b650 test_capi is failing and the fix is not trivial, I prefer to revert --- Python/thread_nt.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Python/thread_nt.h') diff --git a/Python/thread_nt.h b/Python/thread_nt.h index ee2079fc61..ab5a08168f 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -389,11 +389,20 @@ PyThread_delete_key(int key) TlsFree(key); } +/* We must be careful to emulate the strange semantics implemented in thread.c, + * where the value is only set if it hasn't been set before. + */ int PyThread_set_key_value(int key, void *value) { BOOL ok; + void *oldvalue; + assert(value != NULL); + oldvalue = TlsGetValue(key); + if (oldvalue != NULL) + /* ignore value if already set */ + return 0; ok = TlsSetValue(key, value); if (!ok) return -1; -- cgit v1.2.1