--- Python-3.4.3/Include/pythread.h.orig 2015-02-25 05:27:44.000000000 -0600 +++ Python-3.4.3/Include/pythread.h 2015-05-05 11:27:20.117994100 -0500 @@ -77,11 +77,11 @@ PyAPI_FUNC(int) PyThread_set_stacksize(s PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); /* Thread Local Storage (TLS) API */ -PyAPI_FUNC(int) PyThread_create_key(void); -PyAPI_FUNC(void) PyThread_delete_key(int); -PyAPI_FUNC(int) PyThread_set_key_value(int, void *); -PyAPI_FUNC(void *) PyThread_get_key_value(int); -PyAPI_FUNC(void) PyThread_delete_key_value(int key); +PyAPI_FUNC(long) PyThread_create_key(void); +PyAPI_FUNC(void) PyThread_delete_key(long); +PyAPI_FUNC(int) PyThread_set_key_value(long, void *); +PyAPI_FUNC(void *) PyThread_get_key_value(long); +PyAPI_FUNC(void) PyThread_delete_key_value(long key); /* Cleanup after a fork */ PyAPI_FUNC(void) PyThread_ReInitTLS(void); --- Python-3.4.3/Python/pystate.c.orig 2015-02-25 05:27:46.000000000 -0600 +++ Python-3.4.3/Python/pystate.c 2015-05-05 11:27:20.122994700 -0500 @@ -37,7 +37,7 @@ static PyThread_type_lock head_mutex = N GILState implementation */ static PyInterpreterState *autoInterpreterState = NULL; -static int autoTLSkey = 0; +static long autoTLSkey = 0L; #else #define HEAD_INIT() /* Nothing */ #define HEAD_LOCK() /* Nothing */ --- Python-3.4.3/Python/thread_pthread.h.orig 2015-02-25 05:27:46.000000000 -0600 +++ Python-3.4.3/Python/thread_pthread.h 2015-05-05 11:27:20.126495200 -0500 @@ -603,28 +603,28 @@ _pythread_pthread_set_stacksize(size_t s #define Py_HAVE_NATIVE_TLS -int +long PyThread_create_key(void) { pthread_key_t key; int fail = pthread_key_create(&key, NULL); - return fail ? -1 : key; + return fail ? -1L : (long) key; } void -PyThread_delete_key(int key) +PyThread_delete_key(long key) { pthread_key_delete(key); } void -PyThread_delete_key_value(int key) +PyThread_delete_key_value(long key) { pthread_setspecific(key, NULL); } int -PyThread_set_key_value(int key, void *value) +PyThread_set_key_value(long key, void *value) { int fail; fail = pthread_setspecific(key, value); @@ -632,7 +632,7 @@ PyThread_set_key_value(int key, void *va } void * -PyThread_get_key_value(int key) +PyThread_get_key_value(long key) { return pthread_getspecific(key); }