diff -ruN misc/Python-2.7.18/Modules/fcntlmodule.c misc/build/Python-2.7.18/Modules/fcntlmodule.c --- misc/Python-2.7.18/Modules/fcntlmodule.c 2019-10-19 13:38:44.000000000 -0500 +++ misc/build/Python-2.7.18/Modules/fcntlmodule.c 2020-01-09 22:59:15.052886000 -0500 @@ -98,20 +98,15 @@ { #define IOCTL_BUFSZ 1024 int fd; - /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I' + /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k' format for the 'code' parameter because Python turns 0x8000000 into either a large positive number (PyLong or PyInt on 64-bit platforms) or a negative number on others (32-bit PyInt) whereas the system expects it to be a 32bit bit field value regardless of it being passed as an int or unsigned long on - various platforms. See the termios.TIOCSWINSZ constant across - platforms for an example of this. - - If any of the 64bit platforms ever decide to use more than 32bits - in their unsigned long ioctl codes this will break and need - special casing based on the platform being built on. + various platforms. */ - unsigned int code; + unsigned long code; int arg; int ret; char *str; @@ -119,7 +114,7 @@ int mutate_arg = 1; char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */ - if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl", + if (PyArg_ParseTuple(args, "O&kw#|i:ioctl", conv_descriptor, &fd, &code, &str, &len, &mutate_arg)) { char *arg; @@ -170,7 +165,7 @@ } PyErr_Clear(); - if (PyArg_ParseTuple(args, "O&Is#:ioctl", + if (PyArg_ParseTuple(args, "O&ks#:ioctl", conv_descriptor, &fd, &code, &str, &len)) { if (len > IOCTL_BUFSZ) { PyErr_SetString(PyExc_ValueError, @@ -192,7 +187,7 @@ PyErr_Clear(); arg = 0; if (!PyArg_ParseTuple(args, - "O&I|i;ioctl requires a file or file descriptor," + "O&k|i;ioctl requires a file or file descriptor," " an integer and optionally an integer or buffer argument", conv_descriptor, &fd, &code, &arg)) { return NULL; diff -ruN misc/Python-2.7.18/Python/thread_pthread.h misc/build/Python-2.7.18/Python/thread_pthread.h --- misc/Python-2.7.18/Python/thread_pthread.h 2019-10-19 13:38:44.000000000 -0500 +++ misc/build/Python-2.7.18/Python/thread_pthread.h 2020-01-09 22:59:15.053731000 -0500 @@ -38,13 +38,18 @@ #endif #endif +#ifdef __FreeBSD__ +#include +#endif + /* The POSIX spec says that implementations supporting the sem_* family of functions must indicate this by defining _POSIX_SEMAPHORES. */ #ifdef _POSIX_SEMAPHORES /* On FreeBSD 4.x, _POSIX_SEMAPHORES is defined empty, so we need to add 0 to make it work there as well. */ -#if (_POSIX_SEMAPHORES+0) == -1 +#if defined(__FreeBSD__) && __FreeBSD_version < 701104 && \ + (_POSIX_SEMAPHORES+0) == -1 #define HAVE_BROKEN_POSIX_SEMAPHORES #else #include @@ -56,7 +61,6 @@ in default setting. So the process scope is preferred to get enough number of threads to work. */ #ifdef __FreeBSD__ -#include #if __FreeBSD_version >= 500000 && __FreeBSD_version < 504101 #undef PTHREAD_SYSTEM_SCHED_SUPPORTED #endif @@ -184,6 +188,7 @@ { pthread_t th; int status; + sigset_t set, oset; #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) pthread_attr_t attrs; #endif @@ -212,6 +217,8 @@ #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM); #endif + sigfillset(&set); + SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset); pythread_callback *callback = malloc(sizeof(pythread_callback)); @@ -230,6 +237,7 @@ #endif pythread_wrapper, callback); + SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL); #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) pthread_attr_destroy(&attrs); #endif diff -ruN misc/Python-2.7.18/configure misc/build/Python-2.7.18/configure --- misc/Python-2.7.18/configure 2019-10-19 13:38:44.000000000 -0500 +++ misc/build/Python-2.7.18/configure 2020-01-09 22:59:15.072666000 -0500 @@ -5477,7 +5477,7 @@ ;; SunOS*) LDLIBRARY='libpython$(VERSION).so' - BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)' + BLDLIBRARY=-R\'\$\$ORIGIN\'' -L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} INSTSONAME="$LDLIBRARY".$SOVERSION ;; @@ -5485,11 +5485,6 @@ LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} - case $ac_sys_system in - FreeBSD*) - SOVERSION=`echo $SOVERSION|cut -d "." -f 1` - ;; - esac INSTSONAME="$LDLIBRARY".$SOVERSION ;; hp*|HP*)