MSYS2-packages/python/011-3.6-thread-cygwin64.patch
2020-03-02 12:44:15 +03:00

89 lines
2.8 KiB
Diff

--- 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
@@ -74,11 +74,11 @@ PyAPI_FUNC(int) PyThread_set_stacksize(s
platforms, but it is not POSIX-compliant. Therefore, the new TSS API uses
opaque data type to represent TSS keys to be compatible (see PEP 539).
*/
-PyAPI_FUNC(int) PyThread_create_key(void) Py_DEPRECATED(3.7);
-PyAPI_FUNC(void) PyThread_delete_key(int key) Py_DEPRECATED(3.7);
-PyAPI_FUNC(int) PyThread_set_key_value(int key, void *value) Py_DEPRECATED(3.7);
-PyAPI_FUNC(void *) PyThread_get_key_value(int key) Py_DEPRECATED(3.7);
-PyAPI_FUNC(void) PyThread_delete_key_value(int key) Py_DEPRECATED(3.7);
+PyAPI_FUNC(long) PyThread_create_key(void) Py_DEPRECATED(3.7);
+PyAPI_FUNC(void) PyThread_delete_key(long key) Py_DEPRECATED(3.7);
+PyAPI_FUNC(int) PyThread_set_key_value(long key, void *value) Py_DEPRECATED(3.7);
+PyAPI_FUNC(void *) PyThread_get_key_value(long key) Py_DEPRECATED(3.7);
+PyAPI_FUNC(void) PyThread_delete_key_value(long key) Py_DEPRECATED(3.7);
/* Cleanup after a fork */
PyAPI_FUNC(void) PyThread_ReInitTLS(void) Py_DEPRECATED(3.7);
--- Python-3.6.0/Python/thread_pthread.h.orig 2016-12-22 21:21:22.000000000 -0500
+++ Python-3.6.0/Python/thread_pthread.h 2017-02-08 05:18:45.791168100 -0500
@@ -603,44 +603,47 @@
removing this API.
*/
-int
+long
PyThread_create_key(void)
{
#ifdef PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT
pthread_key_t key;
int fail = pthread_key_create(&key, NULL);
if (fail)
- return -1;
- if (key > INT_MAX) {
+ return -1L;
+#ifndef __CYGWIN__
+ /* Cygwin pthread types are pointers, which may "overflow" signed long */
+ if (key > LONG_MAX) {
/* Issue #22206: handle integer overflow */
pthread_key_delete(key);
errno = ENOMEM;
- return -1;
+ return -1L;
}
- return (int)key;
+ return (long)key;
+#endif
#else
- return -1; /* never return valid key value. */
+ return -1L; /* never return valid key value. */
#endif
}
void
-PyThread_delete_key(int key)
+PyThread_delete_key(long key)
{
#ifdef PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT
pthread_key_delete(key);
#endif
}
void
-PyThread_delete_key_value(int key)
+PyThread_delete_key_value(long key)
{
#ifdef PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT
pthread_setspecific(key, NULL);
#endif
}
int
-PyThread_set_key_value(int key, void *value)
+PyThread_set_key_value(long key, void *value)
{
#ifdef PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT
int fail;
@@ -640,7 +640,7 @@ PyThread_set_key_value(int key, void *va
}
void *
-PyThread_get_key_value(int key)
+PyThread_get_key_value(long key)
{
#ifdef PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT
return pthread_getspecific(key);
#else