1diff -ruN misc/Python-2.7.18/Modules/fcntlmodule.c misc/build/Python-2.7.18/Modules/fcntlmodule.c 2--- misc/Python-2.7.18/Modules/fcntlmodule.c 2019-10-19 13:38:44.000000000 -0500 3+++ misc/build/Python-2.7.18/Modules/fcntlmodule.c 2020-01-09 22:59:15.052886000 -0500 4@@ -98,20 +98,15 @@ 5 { 6 #define IOCTL_BUFSZ 1024 7 int fd; 8- /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I' 9+ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k' 10 format for the 'code' parameter because Python turns 0x8000000 11 into either a large positive number (PyLong or PyInt on 64-bit 12 platforms) or a negative number on others (32-bit PyInt) 13 whereas the system expects it to be a 32bit bit field value 14 regardless of it being passed as an int or unsigned long on 15- various platforms. See the termios.TIOCSWINSZ constant across 16- platforms for an example of this. 17- 18- If any of the 64bit platforms ever decide to use more than 32bits 19- in their unsigned long ioctl codes this will break and need 20- special casing based on the platform being built on. 21+ various platforms. 22 */ 23- unsigned int code; 24+ unsigned long code; 25 int arg; 26 int ret; 27 char *str; 28@@ -119,7 +114,7 @@ 29 int mutate_arg = 1; 30 char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */ 31 32- if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl", 33+ if (PyArg_ParseTuple(args, "O&kw#|i:ioctl", 34 conv_descriptor, &fd, &code, 35 &str, &len, &mutate_arg)) { 36 char *arg; 37@@ -170,7 +165,7 @@ 38 } 39 40 PyErr_Clear(); 41- if (PyArg_ParseTuple(args, "O&Is#:ioctl", 42+ if (PyArg_ParseTuple(args, "O&ks#:ioctl", 43 conv_descriptor, &fd, &code, &str, &len)) { 44 if (len > IOCTL_BUFSZ) { 45 PyErr_SetString(PyExc_ValueError, 46@@ -192,7 +187,7 @@ 47 PyErr_Clear(); 48 arg = 0; 49 if (!PyArg_ParseTuple(args, 50- "O&I|i;ioctl requires a file or file descriptor," 51+ "O&k|i;ioctl requires a file or file descriptor," 52 " an integer and optionally an integer or buffer argument", 53 conv_descriptor, &fd, &code, &arg)) { 54 return NULL; 55diff -ruN misc/Python-2.7.18/Python/thread_pthread.h misc/build/Python-2.7.18/Python/thread_pthread.h 56--- misc/Python-2.7.18/Python/thread_pthread.h 2019-10-19 13:38:44.000000000 -0500 57+++ misc/build/Python-2.7.18/Python/thread_pthread.h 2020-01-09 22:59:15.053731000 -0500 58@@ -38,13 +38,18 @@ 59 #endif 60 #endif 61 62+#ifdef __FreeBSD__ 63+#include <osreldate.h> 64+#endif 65+ 66 /* The POSIX spec says that implementations supporting the sem_* 67 family of functions must indicate this by defining 68 _POSIX_SEMAPHORES. */ 69 #ifdef _POSIX_SEMAPHORES 70 /* On FreeBSD 4.x, _POSIX_SEMAPHORES is defined empty, so 71 we need to add 0 to make it work there as well. */ 72-#if (_POSIX_SEMAPHORES+0) == -1 73+#if defined(__FreeBSD__) && __FreeBSD_version < 701104 && \ 74+ (_POSIX_SEMAPHORES+0) == -1 75 #define HAVE_BROKEN_POSIX_SEMAPHORES 76 #else 77 #include <semaphore.h> 78@@ -56,7 +61,6 @@ 79 in default setting. So the process scope is preferred to get 80 enough number of threads to work. */ 81 #ifdef __FreeBSD__ 82-#include <osreldate.h> 83 #if __FreeBSD_version >= 500000 && __FreeBSD_version < 504101 84 #undef PTHREAD_SYSTEM_SCHED_SUPPORTED 85 #endif 86@@ -184,6 +188,7 @@ 87 { 88 pthread_t th; 89 int status; 90+ sigset_t set, oset; 91 #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) 92 pthread_attr_t attrs; 93 #endif 94@@ -212,6 +217,8 @@ 95 #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) 96 pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM); 97 #endif 98+ sigfillset(&set); 99+ SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset); 100 101 pythread_callback *callback = malloc(sizeof(pythread_callback)); 102 103@@ -230,6 +237,7 @@ 104 #endif 105 pythread_wrapper, callback); 106 107+ SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL); 108 #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) 109 pthread_attr_destroy(&attrs); 110 #endif 111diff -ruN misc/Python-2.7.18/configure misc/build/Python-2.7.18/configure 112--- misc/Python-2.7.18/configure 2019-10-19 13:38:44.000000000 -0500 113+++ misc/build/Python-2.7.18/configure 2020-01-09 22:59:15.072666000 -0500 114@@ -5477,7 +5477,7 @@ 115 ;; 116 SunOS*) 117 LDLIBRARY='libpython$(VERSION).so' 118- BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)' 119+ BLDLIBRARY=-R\'\$\$ORIGIN\'' -L. -lpython$(VERSION)' 120 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} 121 INSTSONAME="$LDLIBRARY".$SOVERSION 122 ;; 123@@ -5485,11 +5485,6 @@ 124 LDLIBRARY='libpython$(VERSION).so' 125 BLDLIBRARY='-L. -lpython$(VERSION)' 126 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} 127- case $ac_sys_system in 128- FreeBSD*) 129- SOVERSION=`echo $SOVERSION|cut -d "." -f 1` 130- ;; 131- esac 132 INSTSONAME="$LDLIBRARY".$SOVERSION 133 ;; 134 hp*|HP*) 135