From 520078a330996193f1e8eb286e1ceaa7a7e2f71c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 9 May 2020 12:14:17 -0700 Subject: [PATCH] build/pkgs/python2: Remove --- build/pkgs/python2/SPKG.rst | 101 ---- build/pkgs/python2/checksums.ini | 4 - build/pkgs/python2/dependencies | 5 - build/pkgs/python2/package-version.txt | 1 - .../python2/patches/2.6.5-FD_SETSIZE.patch | 45 -- build/pkgs/python2/patches/cygwin64.patch | 32 -- .../patches/descr_ref-issue_25750.patch | 58 -- .../patches/getcallargs-issue_20108.patch | 26 - .../hashlibfallbacks-issue_18000.patch | 69 --- .../patches/linux_linking_issue_25229.patch | 13 - .../python2/patches/macos_no_include.patch | 72 --- .../python2/patches/ncurses-issue_14438.patch | 17 - .../python2/patches/ncurses-issue_9665.patch | 26 - .../patches/no_strict_proto-issue_5755.patch | 26 - build/pkgs/python2/patches/permissions.patch | 11 - .../patches/re_match_index-issue_27177.patch | 37 -- build/pkgs/python2/patches/socket.patch | 21 - build/pkgs/python2/patches/tinfo.patch | 123 ----- .../python2/patches/trashcan_heap_type.patch | 64 --- .../python2/patches/trashcan_subclass.patch | 496 ------------------ .../python2/patches/uuid-issue_11063.patch | 154 ------ build/pkgs/python2/spkg-build.in | 1 - build/pkgs/python2/spkg-check.in | 1 - build/pkgs/python2/spkg-install.in | 1 - build/pkgs/python2/type | 1 - 25 files changed, 1405 deletions(-) delete mode 100644 build/pkgs/python2/SPKG.rst delete mode 100644 build/pkgs/python2/checksums.ini delete mode 100644 build/pkgs/python2/dependencies delete mode 100644 build/pkgs/python2/package-version.txt delete mode 100644 build/pkgs/python2/patches/2.6.5-FD_SETSIZE.patch delete mode 100644 build/pkgs/python2/patches/cygwin64.patch delete mode 100644 build/pkgs/python2/patches/descr_ref-issue_25750.patch delete mode 100644 build/pkgs/python2/patches/getcallargs-issue_20108.patch delete mode 100644 build/pkgs/python2/patches/hashlibfallbacks-issue_18000.patch delete mode 100644 build/pkgs/python2/patches/linux_linking_issue_25229.patch delete mode 100644 build/pkgs/python2/patches/macos_no_include.patch delete mode 100644 build/pkgs/python2/patches/ncurses-issue_14438.patch delete mode 100644 build/pkgs/python2/patches/ncurses-issue_9665.patch delete mode 100644 build/pkgs/python2/patches/no_strict_proto-issue_5755.patch delete mode 100644 build/pkgs/python2/patches/permissions.patch delete mode 100644 build/pkgs/python2/patches/re_match_index-issue_27177.patch delete mode 100644 build/pkgs/python2/patches/socket.patch delete mode 100644 build/pkgs/python2/patches/tinfo.patch delete mode 100644 build/pkgs/python2/patches/trashcan_heap_type.patch delete mode 100644 build/pkgs/python2/patches/trashcan_subclass.patch delete mode 100644 build/pkgs/python2/patches/uuid-issue_11063.patch delete mode 120000 build/pkgs/python2/spkg-build.in delete mode 120000 build/pkgs/python2/spkg-check.in delete mode 120000 build/pkgs/python2/spkg-install.in delete mode 100644 build/pkgs/python2/type diff --git a/build/pkgs/python2/SPKG.rst b/build/pkgs/python2/SPKG.rst deleted file mode 100644 index 75411f544c0..00000000000 --- a/build/pkgs/python2/SPKG.rst +++ /dev/null @@ -1,101 +0,0 @@ -python -====== - -Description ------------ - -Python is a dynamic object-oriented programming language that can be -used for many kinds of software development. It offers strong support -for integration with other languages and tools, comes with extensive -standard libraries, and can be learned in a few days. Many Python -programmers report substantial productivity gains and feel the language -encourages the development of higher quality, more maintainable code. - -For more details see http://www.python.org - -License -------- - -Python is licensed under the PSF LICENSE. The Python license imposes -very few restrictions on what you can do with Python. Most of the source -code is copyrighted by the Python Software Foundation (PSF). A few files -have a different copyright owner, but the same license applies to all of -them. Python's licensing is GPL compatible. - -For more details see http://www.python.org/psf/license/ - - -Upstream Contact ----------------- - -There are a large number of community resources. For more details see -http://www.python.org/community/ - -Dependencies ------------- - -- GNU patch -- readline -- libpng -- SQLite - - -Special Update/Build Instructions ---------------------------------- - -- We keep a copy of the stdlib 'random' module in - - src/sage/cpython/_py2_random.py. Normally it shouldn't be necessary - to update this, but when upgrading Python make sure to bring over - any security updates from the upstream 'random' module in the - unlikely - chance there are any. This might mean updating any "random" test - results - that depend on the implementation details of the random module. - -- Spaces in SAGE_ROOT aren't yet fully supported by this package, - - since we put $SAGE_LOCAL/... into CPPFLAGS and LDFLAGS, which - wouldn't work then. - -Patches -~~~~~~~ - -- socket.patch: Work around an SSL issue. -- permissions.patch: Changes the permission of installed libraries - - to 0755 (like any other library) instead of 0555. - -- sys_path_security-issue_16202.patch: ensure that the current working - - directory or the script directory is prepended to sys.path only if - there is no security risk in doing so. - -- ncurses-issue_9665.patch: Fixes Python issue #9665 (by patching - configure - - and configure.in after running autotools). - -- ncurses-issue_14438.patch: Fixes Python issue #14438 (ncurses) -- disable_print_refs_debug.patch: Remove some unused debug output - - that breaks doctests. - -- no_strict_proto-issue_5755.patch: don't add -Wstrict-prototypes - compiler - - flag, which isn't valid for C++ (but Python uses the same compiler - flags - for C and C++). See http://bugs.python.org/issue5755. - -- hashlibfallbacks-issue_18000.patch: Fixed Python issue #18000. -- tinfo.patch: make sure tinfo is correctly linked in when needed on - Cygwin. -- uuid-issue_11063.patch: patch from Python issue 11063; reduce uuid - - module import side effects and fix thread related issues. - -- getcallargs-issue_20108.patch: fix inspect.getcallargs() when the - - function has a "func" keyword argument. Needed for @interact from - ipywidgets. diff --git a/build/pkgs/python2/checksums.ini b/build/pkgs/python2/checksums.ini deleted file mode 100644 index 186826b266a..00000000000 --- a/build/pkgs/python2/checksums.ini +++ /dev/null @@ -1,4 +0,0 @@ -tarball=Python-VERSION.tar.xz -sha1=f99348a095ec4a6411c84c0d15343d11920c9724 -md5=a80ae3cc478460b922242f43a1b4094d -cksum=3147661506 diff --git a/build/pkgs/python2/dependencies b/build/pkgs/python2/dependencies deleted file mode 100644 index f6d4a1622ab..00000000000 --- a/build/pkgs/python2/dependencies +++ /dev/null @@ -1,5 +0,0 @@ -zlib readline sqlite libpng bzip2 | xz - ----------- -All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/python2/package-version.txt b/build/pkgs/python2/package-version.txt deleted file mode 100644 index cf7deab283c..00000000000 --- a/build/pkgs/python2/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -2.7.15.p1 diff --git a/build/pkgs/python2/patches/2.6.5-FD_SETSIZE.patch b/build/pkgs/python2/patches/2.6.5-FD_SETSIZE.patch deleted file mode 100644 index 1059ca4ad45..00000000000 --- a/build/pkgs/python2/patches/2.6.5-FD_SETSIZE.patch +++ /dev/null @@ -1,45 +0,0 @@ -This patch has never been submitted upstream for some reason, but it simply -increases the default number of file descriptors the Python process can have on -Cygwin, which mitigates some issues; see -https://cygwin.com/ml/cygwin/2011-03/msg00651.html ---- a/Modules/selectmodule.c 2012-02-02 22:35:21.835125000 -0500 -+++ b/Modules/selectmodule.c 2012-02-02 22:41:41.210125000 -0500 -@@ -6,6 +6,21 @@ - >= 0. - */ - -+/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined. -+ 64 is too small (too many people have bumped into that limit). -+ Here we boost it. -+ -+ Cygwin also defines FD_SETSIZE to 64, so also increase the limit on -+ Cygwin. We must do this before sys/types.h is included, which otherwise -+ sets FD_SETSIZE to the default. -+ -+ Users who want even more than the boosted limit should #define -+ FD_SETSIZE higher before this; e.g., via compiler /D switch. -+*/ -+#if (defined(MS_WINDOWS) || defined(__CYGWIN__)) && !defined(FD_SETSIZE) -+#define FD_SETSIZE 512 -+#endif -+ - #include "Python.h" - #include - -@@ -16,16 +31,6 @@ - #undef HAVE_BROKEN_POLL - #endif - --/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined. -- 64 is too small (too many people have bumped into that limit). -- Here we boost it. -- Users who want even more than the boosted limit should #define -- FD_SETSIZE higher before this; e.g., via compiler /D switch. --*/ --#if defined(MS_WINDOWS) && !defined(FD_SETSIZE) --#define FD_SETSIZE 512 --#endif -- - #if defined(HAVE_POLL_H) - #include - #elif defined(HAVE_SYS_POLL_H) diff --git a/build/pkgs/python2/patches/cygwin64.patch b/build/pkgs/python2/patches/cygwin64.patch deleted file mode 100644 index 345eeb17322..00000000000 --- a/build/pkgs/python2/patches/cygwin64.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/Modules/_ctypes/libffi/src/x86/ffi.c 2013-02-11 13:24:18.000000000 -0600 -+++ b/Modules/_ctypes/libffi/src/x86/ffi.c 2013-03-12 23:22:18.267762700 -0500 -@@ -28,7 +28,7 @@ - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - --#if !defined(__x86_64__) || defined(_WIN64) -+#if !defined(__x86_64__) || defined(_WIN64) || defined(__CYGWIN__) - - #ifdef _WIN64 - #include ---- a/Modules/_ctypes/libffi/src/x86/win64.S 2013-02-11 13:24:18.000000000 -0600 -+++ b/Modules/_ctypes/libffi/src/x86/win64.S 2013-03-13 04:50:09.526614600 -0500 -@@ -295,7 +295,7 @@ SYMBOL_NAME(ffi_closure_win64): - mov %rax, %rcx # context is first parameter - mov %rsp, %rdx # stack is second parameter - add $48, %rdx # point to start of arguments -- mov $SYMBOL_NAME(ffi_closure_win64_inner), %rax -+ lea SYMBOL_NAME(ffi_closure_win64_inner)(%rip), %rax - callq *%rax # call the real closure function - add $40, %rsp - movq %rax, %xmm0 # If the closure returned a float, ---- a/Modules/_ctypes/libffi/fficonfig.py.in 2013-05-12 05:32:49.000000000 +0200 -+++ b/Modules/_ctypes/libffi/fficonfig.py.in 2013-06-03 22:28:06.617994762 +0200 -@@ -23,6 +23,7 @@ - 'FRV': ['src/frv/eabi.S', 'src/frv/ffi.c'], - 'S390': ['src/s390/sysv.S', 'src/s390/ffi.c'], - 'X86_64': ['src/x86/ffi64.c', 'src/x86/unix64.S', 'src/x86/ffi.c', 'src/x86/sysv.S'], -+ 'X86_WIN64': ['src/x86/ffi.c', 'src/x86/win64.S'], - 'SH': ['src/sh/sysv.S', 'src/sh/ffi.c'], - 'SH64': ['src/sh64/sysv.S', 'src/sh64/ffi.c'], - 'PA': ['src/pa/linux.S', 'src/pa/ffi.c'], diff --git a/build/pkgs/python2/patches/descr_ref-issue_25750.patch b/build/pkgs/python2/patches/descr_ref-issue_25750.patch deleted file mode 100644 index b55cf58a2d2..00000000000 --- a/build/pkgs/python2/patches/descr_ref-issue_25750.patch +++ /dev/null @@ -1,58 +0,0 @@ -When calling tp_descr_get(self, obj, type), make sure that we own a reference to "self" - -diff -ru Python-2.7.9/Objects/typeobject.c Python-2.7.9-fixed//Objects/typeobject.c ---- Python-2.7.9/Objects/typeobject.c 2014-12-10 16:59:57.000000000 +0100 -+++ Python-2.7.9-fixed//Objects/typeobject.c 2015-11-27 20:39:58.276156800 +0100 -@@ -2542,6 +2542,7 @@ - PyTypeObject *metatype = Py_TYPE(type); - PyObject *meta_attribute, *attribute; - descrgetfunc meta_get; -+ PyObject* res; - - if (!PyString_Check(name)) { - PyErr_Format(PyExc_TypeError, -@@ -2563,6 +2564,7 @@ - meta_attribute = _PyType_Lookup(metatype, name); - - if (meta_attribute != NULL) { -+ Py_INCREF(meta_attribute); - meta_get = Py_TYPE(meta_attribute)->tp_descr_get; - - if (meta_get != NULL && PyDescr_IsData(meta_attribute)) { -@@ -2570,10 +2572,11 @@ - * writes. Assume the attribute is not overridden in - * type's tp_dict (and bases): call the descriptor now. - */ -- return meta_get(meta_attribute, (PyObject *)type, -+ res = meta_get(meta_attribute, (PyObject *)type, - (PyObject *)metatype); -+ Py_DECREF(meta_attribute); -+ return res; - } -- Py_INCREF(meta_attribute); - } - - /* No data descriptor found on metatype. Look in tp_dict of this -@@ -2581,6 +2584,7 @@ - attribute = _PyType_Lookup(type, name); - if (attribute != NULL) { - /* Implement descriptor functionality, if any */ -+ Py_INCREF(attribute); - descrgetfunc local_get = Py_TYPE(attribute)->tp_descr_get; - - Py_XDECREF(meta_attribute); -@@ -2588,11 +2592,12 @@ - if (local_get != NULL) { - /* NULL 2nd argument indicates the descriptor was - * found on the target object itself (or a base) */ -- return local_get(attribute, (PyObject *)NULL, -+ res = local_get(attribute, (PyObject *)NULL, - (PyObject *)type); -+ Py_DECREF(attribute); -+ return res; - } - -- Py_INCREF(attribute); - return attribute; - } - diff --git a/build/pkgs/python2/patches/getcallargs-issue_20108.patch b/build/pkgs/python2/patches/getcallargs-issue_20108.patch deleted file mode 100644 index 5756041c93f..00000000000 --- a/build/pkgs/python2/patches/getcallargs-issue_20108.patch +++ /dev/null @@ -1,26 +0,0 @@ -# HG changeset patch -# User Benjamin Peterson -# Date 1388687048 21600 -# Node ID b0d472e3ff42de9fd2b1a702f5874202c2d2b27f -# Parent 8083b887068667a7b62443d56de310e7fe10d3df -avoid parameter name clash (closes #20108) - -diff -ru a/Lib/inspect.py b/Lib/inspect.py ---- a/Lib/inspect.py 2015-05-23 18:09:04.000000000 +0200 -+++ b/Lib/inspect.py 2016-09-21 11:34:16.491938401 +0200 -@@ -892,12 +892,14 @@ - specs.append(formatvarkw(varkw) + formatvalue(locals[varkw])) - return '(' + string.join(specs, ', ') + ')' - --def getcallargs(func, *positional, **named): -+def getcallargs(*func_and_positional, **named): - """Get the mapping of arguments to values. - - A dict is returned, with keys the function argument names (including the - names of the * and ** arguments, if any), and values the respective bound - values from 'positional' and 'named'.""" -+ func = func_and_positional[0] -+ positional = func_and_positional[1:] - args, varargs, varkw, defaults = getargspec(func) - f_name = func.__name__ - arg2value = {} diff --git a/build/pkgs/python2/patches/hashlibfallbacks-issue_18000.patch b/build/pkgs/python2/patches/hashlibfallbacks-issue_18000.patch deleted file mode 100644 index f9a2de2fdc1..00000000000 --- a/build/pkgs/python2/patches/hashlibfallbacks-issue_18000.patch +++ /dev/null @@ -1,69 +0,0 @@ -diff -ur src/Lib/test/test_hashlib.py new/Lib/test/test_hashlib.py ---- a/Lib/test/test_hashlib.py 2013-05-12 04:32:46.000000000 +0100 -+++ b/Lib/test/test_hashlib.py 2013-05-18 12:24:04.055336404 +0100 -@@ -21,9 +21,6 @@ - from test import test_support - from test.test_support import _4G, precisionbigmemtest - --# Were we compiled --with-pydebug or with #define Py_DEBUG? --COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount') -- - - def hexstr(s): - import string -@@ -40,7 +37,7 @@ - 'sha224', 'SHA224', 'sha256', 'SHA256', - 'sha384', 'SHA384', 'sha512', 'SHA512' ) - -- _warn_on_extension_import = COMPILED_WITH_PYDEBUG -+ _warn_on_extension_import = True - - def _conditional_import_module(self, module_name): - """Import a module and return a reference to it or None on failure.""" -diff -ur src/setup.py new/setup.py ---- a/setup.py 2013-05-12 04:32:54.000000000 +0100 -+++ b/setup.py 2013-05-18 12:22:04.417057535 +0100 -@@ -29,9 +29,6 @@ - return sys.platform - host_platform = get_platform() - --# Were we compiled --with-pydebug or with #define Py_DEBUG? --COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) -- - # This global variable is used to hold the list of modules to be disabled. - disabled_module_list = [] - -@@ -854,21 +851,18 @@ - print ("warning: openssl 0x%08x is too old for _hashlib" % - openssl_ver) - missing.append('_hashlib') -- if COMPILED_WITH_PYDEBUG or not have_usable_openssl: -- # The _sha module implements the SHA1 hash algorithm. -- exts.append( Extension('_sha', ['shamodule.c']) ) -- # The _md5 module implements the RSA Data Security, Inc. MD5 -- # Message-Digest Algorithm, described in RFC 1321. The -- # necessary files md5.c and md5.h are included here. -- exts.append( Extension('_md5', -- sources = ['md5module.c', 'md5.c'], -- depends = ['md5.h']) ) -- -- min_sha2_openssl_ver = 0x00908000 -- if COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_openssl_ver: -- # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash -- exts.append( Extension('_sha256', ['sha256module.c']) ) -- exts.append( Extension('_sha512', ['sha512module.c']) ) -+ -+ # We always compile these even when OpenSSL is available (issue #14693). -+ # It's harmless and the object code is tiny (40-50 KB per module, -+ # only loaded when actually used). -+ exts.append( Extension('_sha256', ['sha256module.c'], -+ depends=['hashlib.h']) ) -+ exts.append( Extension('_sha512', ['sha512module.c'], -+ depends=['hashlib.h']) ) -+ exts.append( Extension('_md5', ['md5module.c', 'md5.c'], -+ depends=['hashlib.h']) ) -+ exts.append( Extension('_sha', ['shamodule.c'], -+ depends=['hashlib.h']) ) - - # Modules that provide persistent dictionary-like semantics. You will - # probably want to arrange for at least one of them to be available on diff --git a/build/pkgs/python2/patches/linux_linking_issue_25229.patch b/build/pkgs/python2/patches/linux_linking_issue_25229.patch deleted file mode 100644 index 4d9fb35cc03..00000000000 --- a/build/pkgs/python2/patches/linux_linking_issue_25229.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py -index 3af540e..625f155 100644 ---- a/Lib/distutils/unixccompiler.py -+++ b/Lib/distutils/unixccompiler.py -@@ -238,7 +238,7 @@ class UnixCCompiler(CCompiler): - return ["+s", "-L" + dir] - elif sys.platform[:7] == "irix646" or sys.platform[:6] == "osf1V5": - return ["-rpath", dir] -- elif self._is_gcc(compiler): -+ elif sys.platform[:5] == "linux" or self._is_gcc(compiler): - return "-Wl,-R" + dir - else: - return "-R" + dir diff --git a/build/pkgs/python2/patches/macos_no_include.patch b/build/pkgs/python2/patches/macos_no_include.patch deleted file mode 100644 index 0003924e13c..00000000000 --- a/build/pkgs/python2/patches/macos_no_include.patch +++ /dev/null @@ -1,72 +0,0 @@ -diff --git a/configure b/configure -index 4a047e6..e3c8bdf 100755 ---- a/configure -+++ b/configure -@@ -6102,6 +6102,12 @@ $as_echo "$ac_cv_no_strict_aliasing_ok" >&6; } - Darwin*) - # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd - # used to be here, but non-Apple gcc doesn't accept them. -+ -+cat >>confdefs.h <<_ACEOF -+#define Py_MACOS_SYSROOT `xcrun --show-sdk-path` -+_ACEOF -+ -+ - if test "${CC}" = gcc - then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5 -diff --git a/configure.ac b/configure.ac -index 913d546..6cb1f28 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1155,6 +1155,7 @@ yes) - Darwin*) - # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd - # used to be here, but non-Apple gcc doesn't accept them. -+ AC_DEFINE_UNQUOTED([Py_MACOS_SYSROOT], [`xcrun --show-sdk-path`], [Get the root dir of XCode]) - if test "${CC}" = gcc - then - AC_MSG_CHECKING(which compiler should be used) -diff --git a/pyconfig.h.in b/pyconfig.h.in -index 11c4a66..a4e12a2 100644 ---- a/pyconfig.h.in -+++ b/pyconfig.h.in -@@ -1016,6 +1016,9 @@ - /* Defined if Python is built as a shared library. */ - #undef Py_ENABLE_SHARED - -+/* Get the root dir of XCode */ -+#undef Py_MACOS_SYSROOT -+ - /* Define as the size of the unicode type. */ - #undef Py_UNICODE_SIZE - -diff --git a/setup.py b/setup.py -index 33cecc6..5d6a411 100644 ---- a/setup.py -+++ b/setup.py -@@ -50,7 +50,7 @@ def macosx_sdk_root(): - cflags = sysconfig.get_config_var('CFLAGS') - m = re.search(r'-isysroot\s+(\S+)', cflags) - if m is None: -- sysroot = '/' -+ sysroot = sysconfig.get_config_var('Py_MACOS_SYSROOT') - else: - sysroot = m.group(1) - return sysroot -@@ -92,7 +92,6 @@ def find_file(filename, std_dirs, paths): - # Check the additional directories - for dir in paths: - f = os.path.join(dir, filename) -- - if host_platform == 'darwin' and is_macosx_sdk_path(dir): - f = os.path.join(sysroot, dir[1:], filename) - -@@ -557,6 +556,7 @@ class PyBuildExt(build_ext): - # NOTE: using shlex.split would technically be more correct, but - # also gives a bootstrap problem. Let's hope nobody uses directories - # with whitespace in the name to store libraries. -+ inc_dirs += ['/usr/include'] - cflags, ldflags = sysconfig.get_config_vars( - 'CFLAGS', 'LDFLAGS') - for item in cflags.split(): diff --git a/build/pkgs/python2/patches/ncurses-issue_14438.patch b/build/pkgs/python2/patches/ncurses-issue_14438.patch deleted file mode 100644 index e2500d93401..00000000000 --- a/build/pkgs/python2/patches/ncurses-issue_14438.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -ru a/Include/py_curses.h b/Include/py_curses.h ---- a/Include/py_curses.h 2018-04-15 00:06:30.000000000 +0200 -+++ b/Include/py_curses.h 2018-04-19 14:50:07.967630196 +0200 -@@ -12,6 +12,13 @@ - #endif - #endif /* __APPLE__ */ - -+#ifdef __CYGWIN__ -+/* the following define is necessary for Cygwin; without it, the -+ Cygwin-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python -+ can't get at the WINDOW flags field. */ -+#define NCURSES_INTERNALS -+#endif /* __CYGWIN__ */ -+ - #ifdef __FreeBSD__ - /* - ** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards diff --git a/build/pkgs/python2/patches/ncurses-issue_9665.patch b/build/pkgs/python2/patches/ncurses-issue_9665.patch deleted file mode 100644 index e0d22792a3a..00000000000 --- a/build/pkgs/python2/patches/ncurses-issue_9665.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -ur src.orig/configure.ac src/configure.ac ---- src.orig/configure.ac 2012-09-30 19:16:16.208133911 +0200 -+++ src/configure.ac 2012-09-30 19:15:12.800599068 +0200 -@@ -1245,6 +1245,9 @@ - OSF*) - BASECFLAGS="$BASECFLAGS -mieee" - ;; -+ CYGWIN*) -+ BASECFLAGS="-I/usr/include/ncurses $BASECFLAGS" -+ ;; - esac - ;; - -diff -ur src.orig/configure src/configure ---- src.orig/configure 2012-09-30 19:16:16.216133852 +0200 -+++ src/configure 2012-09-30 19:15:44.876363826 +0200 -@@ -6146,6 +6146,9 @@ - OSF*) - BASECFLAGS="$BASECFLAGS -mieee" - ;; -+ CYGWIN*) -+ BASECFLAGS="-I/usr/include/ncurses $BASECFLAGS" -+ ;; - esac - ;; - diff --git a/build/pkgs/python2/patches/no_strict_proto-issue_5755.patch b/build/pkgs/python2/patches/no_strict_proto-issue_5755.patch deleted file mode 100644 index 2f83403b36a..00000000000 --- a/build/pkgs/python2/patches/no_strict_proto-issue_5755.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -ru src/configure.ac b/configure.ac ---- src/configure.ac 2013-04-06 16:02:41.000000000 +0200 -+++ b/configure.ac 2013-04-11 18:11:17.947929754 +0200 -@@ -1051,9 +1051,6 @@ - then - case $GCC in - yes) -- if test "$CC" != 'g++' ; then -- STRICT_PROTO="-Wstrict-prototypes" -- fi - # For gcc 4.x we need to use -fwrapv so lets check if its supported - if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then - WRAP="-fwrapv" -diff -ru src/configure b/configure ---- src/configure 2013-04-06 16:02:41.000000000 +0200 -+++ b/configure 2013-04-11 18:11:25.737930322 +0200 -@@ -5931,9 +5931,6 @@ - then - case $GCC in - yes) -- if test "$CC" != 'g++' ; then -- STRICT_PROTO="-Wstrict-prototypes" -- fi - # For gcc 4.x we need to use -fwrapv so lets check if its supported - if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then - WRAP="-fwrapv" diff --git a/build/pkgs/python2/patches/permissions.patch b/build/pkgs/python2/patches/permissions.patch deleted file mode 100644 index d982758d9e1..00000000000 --- a/build/pkgs/python2/patches/permissions.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- src.orig/Makefile.pre.in 2013-04-06 15:02:34.000000000 +0100 -+++ src/Makefile.pre.in 2013-04-07 12:59:46.675111329 +0100 -@@ -59,7 +59,7 @@ - # Shared libraries must be installed with executable mode on some systems; - # rather than figuring out exactly which, we always give them executable mode. - # Also, making them read-only seems to be a good idea... --INSTALL_SHARED= ${INSTALL} -m 555 -+INSTALL_SHARED= ${INSTALL} -m 755 - - MKDIR_P= @MKDIR_P@ - diff --git a/build/pkgs/python2/patches/re_match_index-issue_27177.patch b/build/pkgs/python2/patches/re_match_index-issue_27177.patch deleted file mode 100644 index 0a6997642c7..00000000000 --- a/build/pkgs/python2/patches/re_match_index-issue_27177.patch +++ /dev/null @@ -1,37 +0,0 @@ -Fix http://bugs.python.org/issue27177 -diff -ru Python-2.7.10/Lib/test/test_index.py Python-2.7.10-fix-re//Lib/test/test_index.py ---- Python-2.7.10/Lib/test/test_index.py 2015-05-23 18:09:11.000000000 +0200 -+++ Python-2.7.10-fix-re//Lib/test/test_index.py 2016-06-01 15:50:07.274162354 +0200 -@@ -246,6 +246,20 @@ - self.assertEqual(xrange(1, 20)[n], 6) - self.assertEqual(xrange(1, 20).__getitem__(n), 6) - -+class MatchGroupTestCase(unittest.TestCase): -+ -+ def test_re_group(self): -+ n = newstyle() -+ n.ind = 0 -+ o = oldstyle() -+ o.ind = 1 -+ -+ import re -+ p = re.compile('(a)(b)') -+ m = p.match('ab') -+ self.assertEqual(m.group(0), m.group(n)) -+ self.assertEqual(m.group(1), m.group(o)) -+ - class OverflowTestCase(unittest.TestCase): - - def setUp(self): -diff -ru Python-2.7.10/Modules/_sre.c Python-2.7.10-fix-re//Modules/_sre.c ---- Python-2.7.10/Modules/_sre.c 2015-05-23 18:09:19.000000000 +0200 -+++ Python-2.7.10-fix-re//Modules/_sre.c 2016-06-01 15:50:58.614165047 +0200 -@@ -3303,6 +3303,8 @@ - - if (PyInt_Check(index) || PyLong_Check(index)) - return PyInt_AsSsize_t(index); -+ if (PyIndex_Check(index)) -+ return PyNumber_AsSsize_t(index, PyExc_IndexError); - - i = -1; - diff --git a/build/pkgs/python2/patches/socket.patch b/build/pkgs/python2/patches/socket.patch deleted file mode 100644 index 27e4dcb5c33..00000000000 --- a/build/pkgs/python2/patches/socket.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -ru a/Lib/socket.py b/Lib/socket.py ---- a/Lib/socket.py 2018-04-15 00:06:30.000000000 +0200 -+++ b/Lib/socket.py 2018-04-19 14:49:27.227076923 +0200 -@@ -51,6 +51,9 @@ - - try: - import _ssl -+ from _ssl import SSLError as sslerror -+ # we try this second line since sometimes the first -+ # passes even though the module isn't there - except ImportError: - # no SSL support - pass -@@ -64,7 +67,6 @@ - return _realssl.sslwrap_simple(sock, keyfile, certfile) - - # we need to import the same constants we used to... -- from _ssl import SSLError as sslerror - from _ssl import \ - RAND_add, \ - RAND_status, \ diff --git a/build/pkgs/python2/patches/tinfo.patch b/build/pkgs/python2/patches/tinfo.patch deleted file mode 100644 index bc152f51622..00000000000 --- a/build/pkgs/python2/patches/tinfo.patch +++ /dev/null @@ -1,123 +0,0 @@ -diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py -index 62506a6..f80230c 100644 ---- a/Lib/distutils/ccompiler.py -+++ b/Lib/distutils/ccompiler.py -@@ -842,9 +842,9 @@ main (int argc, char **argv) { - def library_filename(self, libname, lib_type='static', # or 'shared' - strip_dir=0, output_dir=''): - assert output_dir is not None -- if lib_type not in ("static", "shared", "dylib", "xcode_stub"): -+ if lib_type not in ("static", "shared", "dylib", "xcode_stub", "import"): - raise ValueError, ("""'lib_type' must be "static", "shared", """ -- """"dylib", or "xcode_stub".""") -+ """"dylib", "xcode_stub" or "import".""") - fmt = getattr(self, lib_type + "_lib_format") - ext = getattr(self, lib_type + "_lib_extension") - -diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py -index 4c35676..54f8356 100644 ---- a/Lib/distutils/unixccompiler.py -+++ b/Lib/distutils/unixccompiler.py -@@ -80,10 +80,12 @@ class UnixCCompiler(CCompiler): - shared_lib_extension = ".so" - dylib_lib_extension = ".dylib" - xcode_stub_lib_extension = ".tbd" -- static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s" -+ import_lib_extension = ".dll.a" -+ import_lib_format = static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s" - xcode_stub_lib_format = dylib_lib_format - if sys.platform == "cygwin": - exe_extension = ".exe" -+ shared_lib_extension = ".dll" - - def preprocess(self, source, - output_file=None, macros=None, include_dirs=None, -@@ -249,6 +251,7 @@ class UnixCCompiler(CCompiler): - dylib_f = self.library_filename(lib, lib_type='dylib') - xcode_stub_f = self.library_filename(lib, lib_type='xcode_stub') - static_f = self.library_filename(lib, lib_type='static') -+ import_f = self.library_filename(lib, lib_type='import') - - if sys.platform == 'darwin': - # On OSX users can specify an alternate SDK using -@@ -279,6 +282,7 @@ class UnixCCompiler(CCompiler): - - - for dir in dirs: -+ implib = os.path.join(dir, import_f) - shared = os.path.join(dir, shared_f) - dylib = os.path.join(dir, dylib_f) - static = os.path.join(dir, static_f) -@@ -297,7 +301,9 @@ class UnixCCompiler(CCompiler): - # data to go on: GCC seems to prefer the shared library, so I'm - # assuming that *all* Unix C compilers do. And of course I'm - # ignoring even GCC's "-static" option. So sue me. -- if os.path.exists(dylib): -+ if os.path.exists(implib): -+ return implib -+ elif os.path.exists(dylib): - return dylib - elif os.path.exists(xcode_stub): - return xcode_stub -@@ -308,3 +314,22 @@ class UnixCCompiler(CCompiler): - - # Oops, didn't find it in *any* of 'dirs' - return None -+ -+ def implib_to_dll(self, dirs, implib, debug=0): -+ fp = os.popen("dlltool -I %s" % implib) -+ dlltool_output = fp.readlines() -+ ret = fp.close() -+ -+ if ret is None or ret >> 8 == 0: -+ for ln in dlltool_output: -+ for dir in dirs: -+ dll = os.path.join(dir, ln.rstrip('\n')) -+ # We're second-guessing the linker here, with not much hard -+ # data to go on: GCC seems to prefer the shared library, so I'm -+ # assuming that *all* Unix C compilers do. And of course I'm -+ # ignoring even GCC's "-static" option. So sue me. -+ if os.path.exists(dll): -+ return dll -+ -+ # Oops, didn't find it in *any* of 'dirs' -+ return None -diff --git a/setup.py b/setup.py -index aa08ada..f41d200 100644 ---- a/setup.py -+++ b/setup.py -@@ -726,8 +726,12 @@ class PyBuildExt(build_ext): - do_readline = self.compiler.find_library_file(lib_dirs, 'readline') - readline_termcap_library = "" - curses_library = "" -- # Determine if readline is already linked against curses or tinfo. -+ # Determine if readline is linked against curses or tinfo. - if do_readline and find_executable('ldd'): -+ # On Cygwin we have to find out which dll the implib point to -+ if host_platform == "cygwin" and find_executable('dlltool'): -+ do_readline = self.compiler.implib_to_dll(os.getenv('PATH').split(os.pathsep) + lib_dirs, do_readline) -+ - fp = os.popen("ldd %s" % do_readline) - ldd_output = fp.readlines() - ret = fp.close() -@@ -778,7 +782,10 @@ class PyBuildExt(build_ext): - - readline_libs = ['readline'] - if readline_termcap_library: -- pass # Issue 7384: Already linked against curses or tinfo. -+ if host_platform != "cygwin": -+ pass # Issue 7384: Already linked against curses or tinfo. -+ else: -+ readline_libs.append(readline_termcap_library) - elif curses_library: - readline_libs.append(curses_library) - elif self.compiler.find_library_file(lib_dirs + -@@ -1370,6 +1377,8 @@ class PyBuildExt(build_ext): - # _curses_panel.so must link with panelw. - panel_library = 'panelw' - curses_libs = [curses_library] -+ if readline_termcap_library == 'tinfo' and host_platform == "cygwin": -+ curses_libs.append(readline_termcap_library) - curses_incs = find_file('curses.h', inc_dirs, - [os.path.join(d, 'ncursesw') for d in inc_dirs]) - exts.append( Extension('_curses', ['_cursesmodule.c'], diff --git a/build/pkgs/python2/patches/trashcan_heap_type.patch b/build/pkgs/python2/patches/trashcan_heap_type.patch deleted file mode 100644 index b8f3ead3968..00000000000 --- a/build/pkgs/python2/patches/trashcan_heap_type.patch +++ /dev/null @@ -1,64 +0,0 @@ -https://github.com/python/cpython/pull/12725 - -commit 6f8de0b75e0ca987cf5e734cf9c4bb91762efcf3 -Author: Jeroen Demeyer -Date: Mon Apr 8 14:08:37 2019 +0200 - - bpo-36556: trashcan should not cause duplicated __del__ - -diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py -index 7e47b2d..3e4d0f9 100644 ---- a/Lib/test/test_gc.py -+++ b/Lib/test/test_gc.py -@@ -307,6 +307,24 @@ class GCTests(unittest.TestCase): - v = {1: v, 2: Ouch()} - gc.disable() - -+ def test_no_double_del(self): -+ # bpo-36556: instances of heap types should be deallocated once, -+ # even if the trashcan and __del__ are involved -+ class ObjectCounter(object): -+ count = 0 -+ def __init__(self): -+ type(self).count += 1 -+ def __del__(self): -+ # create temporary involving self, whose deallocation -+ # uses the trashcan -+ L = [self] -+ type(self).count -= 1 -+ L = None -+ for i in range(10000): -+ L = (L, ObjectCounter()) -+ del L -+ self.assertEqual(ObjectCounter.count, 0) -+ - @unittest.skipUnless(threading, "test meaningless on builds without threads") - def test_trashcan_threads(self): - # Issue #13992: trashcan mechanism should be thread-safe -diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-04-08-14-32-28.bpo-36556.lp-8oV.rst b/Misc/NEWS.d/next/Core and Builtins/2019-04-08-14-32-28.bpo-36556.lp-8oV.rst -new file mode 100644 -index 0000000..496bdc5 ---- /dev/null -+++ b/Misc/NEWS.d/next/Core and Builtins/2019-04-08-14-32-28.bpo-36556.lp-8oV.rst -@@ -0,0 +1,2 @@ -+When deleting highly nested objects (where the trashcan mechanism is -+involved), it is less likely that ``__del__`` is called multiple times. -diff --git a/Objects/typeobject.c b/Objects/typeobject.c -index 844fb00..43b35b1 100644 ---- a/Objects/typeobject.c -+++ b/Objects/typeobject.c -@@ -917,6 +917,14 @@ subtype_clear(PyObject *self) - return 0; - } - -+/* bpo-36556: lower the trashcan recursion limit for heap types: this gives -+ * __del__ 10 additional stack frames to work with. This makes it less likely -+ * that the trashcan is used in __del__. Otherwise, an object might seemingly -+ * be resurrected by __del__ when it's still referenced by an object in the -+ * trashcan. */ -+#undef PyTrash_UNWIND_LEVEL -+#define PyTrash_UNWIND_LEVEL 40 -+ - static void - subtype_dealloc(PyObject *self) - { diff --git a/build/pkgs/python2/patches/trashcan_subclass.patch b/build/pkgs/python2/patches/trashcan_subclass.patch deleted file mode 100644 index 401bdb5b865..00000000000 --- a/build/pkgs/python2/patches/trashcan_subclass.patch +++ /dev/null @@ -1,496 +0,0 @@ -See https://github.com/python/cpython/pull/12699 - -commit 324fc4bd0b1fa9cb9e60ab58f8852e8b7fdd8689 -Author: Jeroen Demeyer -Date: Wed Feb 13 15:12:48 2019 +0100 - - [2.7] bpo-35983: skip trashcan for subclasses (GH-11841) - -diff --git a/Include/object.h b/Include/object.h -index 807b241..cc2f3c5 100644 ---- a/Include/object.h -+++ b/Include/object.h -@@ -969,11 +969,11 @@ times. - - When deallocating a container object, it's possible to trigger an unbounded - chain of deallocations, as each Py_DECREF in turn drops the refcount on "the --next" object in the chain to 0. This can easily lead to stack faults, and -+next" object in the chain to 0. This can easily lead to stack overflows, - especially in threads (which typically have less stack space to work with). - --A container object that participates in cyclic gc can avoid this by --bracketing the body of its tp_dealloc function with a pair of macros: -+A container object can avoid this by bracketing the body of its tp_dealloc -+function with a pair of macros: - - static void - mytype_dealloc(mytype *p) -@@ -981,14 +981,14 @@ mytype_dealloc(mytype *p) - ... declarations go here ... - - PyObject_GC_UnTrack(p); // must untrack first -- Py_TRASHCAN_SAFE_BEGIN(p) -+ Py_TRASHCAN_BEGIN(p, mytype_dealloc) - ... The body of the deallocator goes here, including all calls ... - ... to Py_DECREF on contained objects. ... -- Py_TRASHCAN_SAFE_END(p) -+ Py_TRASHCAN_END // there should be no code after this - } - - CAUTION: Never return from the middle of the body! If the body needs to --"get out early", put a label immediately before the Py_TRASHCAN_SAFE_END -+"get out early", put a label immediately before the Py_TRASHCAN_END - call, and goto it. Else the call-depth counter (see below) will stay - above 0 forever, and the trashcan will never get emptied. - -@@ -1004,6 +1004,12 @@ notices this, and calls another routine to deallocate all the objects that - may have been added to the list of deferred deallocations. In effect, a - chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces, - with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. -+ -+Since the tp_dealloc of a subclass typically calls the tp_dealloc of the base -+class, we need to ensure that the trashcan is only triggered on the tp_dealloc -+of the actual class being deallocated. Otherwise we might end up with a -+partially-deallocated object. To check this, the tp_dealloc function must be -+passed as second argument to Py_TRASHCAN_BEGIN(). - */ - - /* This is the old private API, invoked by the macros before 2.7.4. -@@ -1020,26 +1026,38 @@ PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void); - #define PyTrash_UNWIND_LEVEL 50 - - /* Note the workaround for when the thread state is NULL (issue #17703) */ --#define Py_TRASHCAN_SAFE_BEGIN(op) \ -+#define Py_TRASHCAN_BEGIN_CONDITION(op, cond) \ - do { \ -- PyThreadState *_tstate = PyThreadState_GET(); \ -- if (!_tstate || \ -- _tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ -- if (_tstate) \ -- ++_tstate->trash_delete_nesting; -- /* The body of the deallocator is here. */ --#define Py_TRASHCAN_SAFE_END(op) \ -- if (_tstate) { \ -- --_tstate->trash_delete_nesting; \ -- if (_tstate->trash_delete_later \ -- && _tstate->trash_delete_nesting <= 0) \ -- _PyTrash_thread_destroy_chain(); \ -+ PyThreadState *_tstate = NULL; \ -+ /* If "cond" is false, then _tstate remains NULL and the deallocator \ -+ * is run normally without involving the trashcan */ \ -+ if (cond && (_tstate = PyThreadState_GET()) != NULL) { \ -+ if (_tstate->trash_delete_nesting >= PyTrash_UNWIND_LEVEL) { \ -+ /* Store the object (to be deallocated later) and jump past \ -+ * Py_TRASHCAN_END, skipping the body of the deallocator */ \ -+ _PyTrash_thread_deposit_object((PyObject*)op); \ -+ break; \ - } \ -+ ++_tstate->trash_delete_nesting; \ -+ } -+ /* The body of the deallocator is here. */ -+#define Py_TRASHCAN_END \ -+ if (_tstate) { \ -+ --_tstate->trash_delete_nesting; \ -+ if (_tstate->trash_delete_later && _tstate->trash_delete_nesting <= 0) \ -+ _PyTrash_thread_destroy_chain(); \ - } \ -- else \ -- _PyTrash_thread_deposit_object((PyObject*)op); \ - } while (0); - -+#define Py_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN_CONDITION(op, \ -+ Py_TYPE(op)->tp_dealloc == (destructor)(dealloc)) -+ -+/* For backwards compatibility, these macros enable the trashcan -+ * unconditionally */ -+#define Py_TRASHCAN_SAFE_BEGIN(op) Py_TRASHCAN_BEGIN_CONDITION(op, 1) -+#define Py_TRASHCAN_SAFE_END(op) Py_TRASHCAN_END -+ -+ - #ifdef __cplusplus - } - #endif -diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py -index 5eb3f7d..7c63c55 100644 ---- a/Lib/test/test_capi.py -+++ b/Lib/test/test_capi.py -@@ -22,6 +22,41 @@ class CAPITest(unittest.TestCase): - def test_buildvalue_N(self): - _testcapi.test_buildvalue_N() - -+ def test_trashcan_subclass(self): -+ # bpo-35983: Check that the trashcan mechanism for "list" is NOT -+ # activated when its tp_dealloc is being called by a subclass -+ from _testcapi import MyList -+ L = None -+ for i in range(1000): -+ L = MyList((L,)) -+ -+ def test_trashcan_python_class(self): -+ # Check that the trashcan mechanism works properly for a Python -+ # subclass of a class using the trashcan (list in this test) -+ class PyList(list): -+ # Count the number of PyList instances to verify that there is -+ # no memory leak -+ num = 0 -+ def __init__(self, *args): -+ __class__.num += 1 -+ super().__init__(*args) -+ def __del__(self): -+ __class__.num -= 1 -+ -+ for parity in (0, 1): -+ L = None -+ # We need in the order of 2**20 iterations here such that a -+ # typical 8MB stack would overflow without the trashcan. -+ for i in range(2**20): -+ L = PyList((L,)) -+ L.attr = i -+ if parity: -+ # Add one additional nesting layer -+ L = (L,) -+ self.assertGreater(PyList.num, 0) -+ del L -+ self.assertEqual(PyList.num, 0) -+ - - @unittest.skipUnless(threading, 'Threading required for this test.') - class TestPendingCalls(unittest.TestCase): -diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-02-13-16-47-19.bpo-35983.bNxsXv.rst b/Misc/NEWS.d/next/Core and Builtins/2019-02-13-16-47-19.bpo-35983.bNxsXv.rst -new file mode 100644 -index 0000000..1138df6 ---- /dev/null -+++ b/Misc/NEWS.d/next/Core and Builtins/2019-02-13-16-47-19.bpo-35983.bNxsXv.rst -@@ -0,0 +1,3 @@ -+Added new trashcan macros to deal with a double deallocation that could occur -+when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class -+and that base class uses the trashcan mechanism. Patch by Jeroen Demeyer. -diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c -index 67488e7..fb866fa 100644 ---- a/Modules/_testcapimodule.c -+++ b/Modules/_testcapimodule.c -@@ -2944,6 +2944,76 @@ static PyTypeObject test_structmembersType = { - }; - - -+/* Test bpo-35983: create a subclass of "list" which checks that instances -+ * are not deallocated twice */ -+ -+typedef struct { -+ PyListObject list; -+ int deallocated; -+} MyListObject; -+ -+static PyObject * -+MyList_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -+{ -+ PyObject* op = PyList_Type.tp_new(type, args, kwds); -+ ((MyListObject*)op)->deallocated = 0; -+ return op; -+} -+ -+void -+MyList_dealloc(MyListObject* op) -+{ -+ if (op->deallocated) { -+ /* We cannot raise exceptions here but we still want the testsuite -+ * to fail when we hit this */ -+ Py_FatalError("MyList instance deallocated twice"); -+ } -+ op->deallocated = 1; -+ PyList_Type.tp_dealloc((PyObject *)op); -+} -+ -+static PyTypeObject MyList_Type = { -+ PyVarObject_HEAD_INIT(NULL, 0) -+ "MyList", -+ sizeof(MyListObject), -+ 0, -+ (destructor)MyList_dealloc, /* tp_dealloc */ -+ 0, /* tp_print */ -+ 0, /* tp_getattr */ -+ 0, /* tp_setattr */ -+ 0, /* tp_reserved */ -+ 0, /* tp_repr */ -+ 0, /* tp_as_number */ -+ 0, /* tp_as_sequence */ -+ 0, /* tp_as_mapping */ -+ 0, /* tp_hash */ -+ 0, /* tp_call */ -+ 0, /* tp_str */ -+ 0, /* tp_getattro */ -+ 0, /* tp_setattro */ -+ 0, /* tp_as_buffer */ -+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ -+ 0, /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ 0, /* tp_methods */ -+ 0, /* tp_members */ -+ 0, /* tp_getset */ -+ 0, /* &PyList_Type */ /* tp_base */ -+ 0, /* tp_dict */ -+ 0, /* tp_descr_get */ -+ 0, /* tp_descr_set */ -+ 0, /* tp_dictoffset */ -+ 0, /* tp_init */ -+ 0, /* tp_alloc */ -+ MyList_new, /* tp_new */ -+}; -+ -+ - PyMODINIT_FUNC - init_testcapi(void) - { -@@ -2961,6 +3031,12 @@ init_testcapi(void) - test_capi to automatically call this */ - PyModule_AddObject(m, "_test_structmembersType", (PyObject *)&test_structmembersType); - -+ MyList_Type.tp_base = &PyList_Type; -+ if (PyType_Ready(&MyList_Type) < 0) -+ return NULL; -+ Py_INCREF(&MyList_Type); -+ PyModule_AddObject(m, "MyList", (PyObject *)&MyList_Type); -+ - PyModule_AddObject(m, "CHAR_MAX", PyInt_FromLong(CHAR_MAX)); - PyModule_AddObject(m, "CHAR_MIN", PyInt_FromLong(CHAR_MIN)); - PyModule_AddObject(m, "UCHAR_MAX", PyInt_FromLong(UCHAR_MAX)); -diff --git a/Objects/descrobject.c b/Objects/descrobject.c -index 8d6e6e3..38f11e9 100644 ---- a/Objects/descrobject.c -+++ b/Objects/descrobject.c -@@ -940,11 +940,11 @@ static void - wrapper_dealloc(wrapperobject *wp) - { - PyObject_GC_UnTrack(wp); -- Py_TRASHCAN_SAFE_BEGIN(wp) -+ Py_TRASHCAN_BEGIN(wp, wrapper_dealloc) - Py_XDECREF(wp->descr); - Py_XDECREF(wp->self); - PyObject_GC_Del(wp); -- Py_TRASHCAN_SAFE_END(wp) -+ Py_TRASHCAN_END - } - - static int -diff --git a/Objects/dictobject.c b/Objects/dictobject.c -index c544ecd..fa2b4b7 100644 ---- a/Objects/dictobject.c -+++ b/Objects/dictobject.c -@@ -1078,7 +1078,7 @@ dict_dealloc(register PyDictObject *mp) - Py_ssize_t fill = mp->ma_fill; - /* bpo-31095: UnTrack is needed before calling any callbacks */ - PyObject_GC_UnTrack(mp); -- Py_TRASHCAN_SAFE_BEGIN(mp) -+ Py_TRASHCAN_BEGIN(mp, dict_dealloc) - for (ep = mp->ma_table; fill > 0; ep++) { - if (ep->me_key) { - --fill; -@@ -1092,7 +1092,7 @@ dict_dealloc(register PyDictObject *mp) - free_list[numfree++] = mp; - else - Py_TYPE(mp)->tp_free((PyObject *)mp); -- Py_TRASHCAN_SAFE_END(mp) -+ Py_TRASHCAN_END - } - - static int -diff --git a/Objects/listobject.c b/Objects/listobject.c -index 24eff76..dc57270 100644 ---- a/Objects/listobject.c -+++ b/Objects/listobject.c -@@ -298,7 +298,7 @@ list_dealloc(PyListObject *op) - { - Py_ssize_t i; - PyObject_GC_UnTrack(op); -- Py_TRASHCAN_SAFE_BEGIN(op) -+ Py_TRASHCAN_BEGIN(op, list_dealloc) - if (op->ob_item != NULL) { - /* Do it backwards, for Christian Tismer. - There's a simple test case where somehow this reduces -@@ -314,7 +314,7 @@ list_dealloc(PyListObject *op) - free_list[numfree++] = op; - else - Py_TYPE(op)->tp_free((PyObject *)op); -- Py_TRASHCAN_SAFE_END(op) -+ Py_TRASHCAN_END - } - - static int -diff --git a/Objects/setobject.c b/Objects/setobject.c -index 31da3db..3dbbcf3 100644 ---- a/Objects/setobject.c -+++ b/Objects/setobject.c -@@ -551,7 +551,7 @@ set_dealloc(PySetObject *so) - Py_ssize_t fill = so->fill; - /* bpo-31095: UnTrack is needed before calling any callbacks */ - PyObject_GC_UnTrack(so); -- Py_TRASHCAN_SAFE_BEGIN(so) -+ Py_TRASHCAN_BEGIN(so, set_dealloc) - if (so->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) so); - -@@ -567,7 +567,7 @@ set_dealloc(PySetObject *so) - free_list[numfree++] = so; - else - Py_TYPE(so)->tp_free(so); -- Py_TRASHCAN_SAFE_END(so) -+ Py_TRASHCAN_END - } - - static int -diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c -index 6f4b18c..ae82163 100644 ---- a/Objects/tupleobject.c -+++ b/Objects/tupleobject.c -@@ -215,7 +215,7 @@ tupledealloc(register PyTupleObject *op) - register Py_ssize_t i; - register Py_ssize_t len = Py_SIZE(op); - PyObject_GC_UnTrack(op); -- Py_TRASHCAN_SAFE_BEGIN(op) -+ Py_TRASHCAN_BEGIN(op, tupledealloc) - if (len > 0) { - i = len; - while (--i >= 0) -@@ -234,7 +234,7 @@ tupledealloc(register PyTupleObject *op) - } - Py_TYPE(op)->tp_free((PyObject *)op); - done: -- Py_TRASHCAN_SAFE_END(op) -+ Py_TRASHCAN_END - } - - static int -diff --git a/Objects/typeobject.c b/Objects/typeobject.c -index 844fb00..c8335ba 100644 ---- a/Objects/typeobject.c -+++ b/Objects/typeobject.c -@@ -922,7 +922,6 @@ subtype_dealloc(PyObject *self) - { - PyTypeObject *type, *base; - destructor basedealloc; -- PyThreadState *tstate = PyThreadState_GET(); - - /* Extract the type; we expect it to be a heap type */ - type = Py_TYPE(self); -@@ -971,16 +970,7 @@ subtype_dealloc(PyObject *self) - /* UnTrack and re-Track around the trashcan macro, alas */ - /* See explanation at end of function for full disclosure */ - PyObject_GC_UnTrack(self); -- ++_PyTrash_delete_nesting; -- ++ tstate->trash_delete_nesting; -- Py_TRASHCAN_SAFE_BEGIN(self); -- --_PyTrash_delete_nesting; -- -- tstate->trash_delete_nesting; -- /* DO NOT restore GC tracking at this point. weakref callbacks -- * (if any, and whether directly here or indirectly in something we -- * call) may trigger GC, and if self is tracked at that point, it -- * will look like trash to GC and GC will try to delete self again. -- */ -+ Py_TRASHCAN_BEGIN(self, subtype_dealloc); - - /* Find the nearest base with a different tp_dealloc */ - base = type; -@@ -1053,11 +1043,7 @@ subtype_dealloc(PyObject *self) - Py_DECREF(type); - - endlabel: -- ++_PyTrash_delete_nesting; -- ++ tstate->trash_delete_nesting; -- Py_TRASHCAN_SAFE_END(self); -- --_PyTrash_delete_nesting; -- -- tstate->trash_delete_nesting; -+ Py_TRASHCAN_END - - /* Explanation of the weirdness around the trashcan macros: - -@@ -1094,67 +1080,6 @@ subtype_dealloc(PyObject *self) - looks like trash to gc too, and gc also tries to delete self - then. But we're already deleting self. Double deallocation is - a subtle disaster. -- -- Q. Why the bizarre (net-zero) manipulation of -- _PyTrash_delete_nesting around the trashcan macros? -- -- A. Some base classes (e.g. list) also use the trashcan mechanism. -- The following scenario used to be possible: -- -- - suppose the trashcan level is one below the trashcan limit -- -- - subtype_dealloc() is called -- -- - the trashcan limit is not yet reached, so the trashcan level -- is incremented and the code between trashcan begin and end is -- executed -- -- - this destroys much of the object's contents, including its -- slots and __dict__ -- -- - basedealloc() is called; this is really list_dealloc(), or -- some other type which also uses the trashcan macros -- -- - the trashcan limit is now reached, so the object is put on the -- trashcan's to-be-deleted-later list -- -- - basedealloc() returns -- -- - subtype_dealloc() decrefs the object's type -- -- - subtype_dealloc() returns -- -- - later, the trashcan code starts deleting the objects from its -- to-be-deleted-later list -- -- - subtype_dealloc() is called *AGAIN* for the same object -- -- - at the very least (if the destroyed slots and __dict__ don't -- cause problems) the object's type gets decref'ed a second -- time, which is *BAD*!!! -- -- The remedy is to make sure that if the code between trashcan -- begin and end in subtype_dealloc() is called, the code between -- trashcan begin and end in basedealloc() will also be called. -- This is done by decrementing the level after passing into the -- trashcan block, and incrementing it just before leaving the -- block. -- -- But now it's possible that a chain of objects consisting solely -- of objects whose deallocator is subtype_dealloc() will defeat -- the trashcan mechanism completely: the decremented level means -- that the effective level never reaches the limit. Therefore, we -- *increment* the level *before* entering the trashcan block, and -- matchingly decrement it after leaving. This means the trashcan -- code will trigger a little early, but that's no big deal. -- -- Q. Are there any live examples of code in need of all this -- complexity? -- -- A. Yes. See SF bug 668433 for code that crashed (when Python was -- compiled in debug mode) before the trashcan level manipulations -- were added. For more discussion, see SF patches 581742, 575073 -- and bug 574207. - */ - } - -diff --git a/Python/traceback.c b/Python/traceback.c -index fd5309a..38327b6 100644 ---- a/Python/traceback.c -+++ b/Python/traceback.c -@@ -23,11 +23,11 @@ static void - tb_dealloc(PyTracebackObject *tb) - { - PyObject_GC_UnTrack(tb); -- Py_TRASHCAN_SAFE_BEGIN(tb) -+ Py_TRASHCAN_BEGIN(tb, tb_dealloc) - Py_XDECREF(tb->tb_next); - Py_XDECREF(tb->tb_frame); - PyObject_GC_Del(tb); -- Py_TRASHCAN_SAFE_END(tb) -+ Py_TRASHCAN_END - } - - static int diff --git a/build/pkgs/python2/patches/uuid-issue_11063.patch b/build/pkgs/python2/patches/uuid-issue_11063.patch deleted file mode 100644 index 731c4325cb8..00000000000 --- a/build/pkgs/python2/patches/uuid-issue_11063.patch +++ /dev/null @@ -1,154 +0,0 @@ -diff --git a/Lib/uuid.py b/Lib/uuid.py -index 7432032..0cbf9f1 100644 ---- a/Lib/uuid.py -+++ b/Lib/uuid.py -@@ -437,68 +437,86 @@ def _netbios_getnode(): - return ((bytes[0]<<40L) + (bytes[1]<<32L) + (bytes[2]<<24L) + - (bytes[3]<<16L) + (bytes[4]<<8L) + bytes[5]) - --# Thanks to Thomas Heller for ctypes and for his help with its use here. -+_ctypes_lib = None - --# If ctypes is available, use it to find system routines for UUID generation. --_uuid_generate_time = _UuidCreate = None --try: -- import ctypes, ctypes.util -- import sys -+def _uuid_generate(attr): -+ """Find system routines for UUID generation""" -+ -+ # Thanks to Thomas Heller for ctypes and for his help with its use here. -+ try: -+ import ctypes -+ import ctypes.util -+ -+ global _ctypes_lib -+ -+ uuid = None -+ # The uuid_generate_* routines are provided by libuuid on at least -+ # Linux and FreeBSD, and provided by libc on Mac OS X. -+ for libname in ['uuid', 'c']: -+ try: -+ if _ctypes_lib is None: -+ _ctypes_lib = ctypes.CDLL(ctypes.util.find_library(libname)) -+ lib = _ctypes_lib -+ except: -+ continue -+ if hasattr(lib, attr): -+ uuid = getattr(lib, attr) -+ break # found what we were looking for -+ -+ # The uuid_generate_* functions are broken on MacOS X 10.5, as noted -+ # in issue #8621 the function generates the same sequence of values -+ # in the parent process and all children created using fork (unless -+ # those children use exec as well). -+ # -+ # Assume that the uuid_generate functions are broken from 10.5 onward, -+ # the test can be adjusted when a later version is fixed. -+ import sys -+ if sys.platform == 'darwin': -+ import os -+ if int(os.uname()[2].split('.')[0]) >= 9: -+ uuid = None -+ return uuid -+ except: -+ pass - -- # The uuid_generate_* routines are provided by libuuid on at least -- # Linux and FreeBSD, and provided by libc on Mac OS X. -- _libnames = ['uuid'] -- if not sys.platform.startswith('win'): -- _libnames.append('c') -- for libname in _libnames: -+ -+def _uuid_create(): -+ """Get random UUID on Windows platform.""" -+ -+ try: -+ # On Windows prior to 2000, UuidCreate gives a UUID containing the -+ # hardware address. On Windows 2000 and later, UuidCreate makes a -+ # random UUID and UuidCreateSequential gives a UUID containing the -+ # hardware address. These routines are provided by the RPC runtime. -+ # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last -+ # 6 bytes returned by UuidCreateSequential are fixed, they don't appear -+ # to bear any relationship to the MAC address of any network device -+ # on the box. - try: -- lib = ctypes.CDLL(ctypes.util.find_library(libname)) -+ import ctypes -+ lib = ctypes.windll.rpcrt4 - except: -- continue -- if hasattr(lib, 'uuid_generate_time'): -- _uuid_generate_time = lib.uuid_generate_time -- break -- del _libnames -- -- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted -- # in issue #8621 the function generates the same sequence of values -- # in the parent process and all children created using fork (unless -- # those children use exec as well). -- # -- # Assume that the uuid_generate functions are broken from 10.5 onward, -- # the test can be adjusted when a later version is fixed. -- if sys.platform == 'darwin': -- import os -- if int(os.uname()[2].split('.')[0]) >= 9: -- _uuid_generate_time = None -- -- # On Windows prior to 2000, UuidCreate gives a UUID containing the -- # hardware address. On Windows 2000 and later, UuidCreate makes a -- # random UUID and UuidCreateSequential gives a UUID containing the -- # hardware address. These routines are provided by the RPC runtime. -- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last -- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear -- # to bear any relationship to the MAC address of any network device -- # on the box. -- try: -- lib = ctypes.windll.rpcrt4 -+ lib = None -+ uuid = getattr(lib, 'UuidCreateSequential', -+ getattr(lib, 'UuidCreate', None)) -+ return uuid - except: -- lib = None -- _UuidCreate = getattr(lib, 'UuidCreateSequential', -- getattr(lib, 'UuidCreate', None)) --except: -- pass -+ pass - - def _unixdll_getnode(): - """Get the hardware address on Unix using ctypes.""" -+ import ctypes - _buffer = ctypes.create_string_buffer(16) -- _uuid_generate_time(_buffer) -+ uuid_generate_time = _uuid_generate("uuid_generate_time") -+ uuid_generate_time(_buffer) - return UUID(bytes=_buffer.raw).node - - def _windll_getnode(): - """Get the hardware address on Windows using ctypes.""" -+ import ctypes - _buffer = ctypes.create_string_buffer(16) -- if _UuidCreate(_buffer) == 0: -+ UuidCreate = _uuid_create() -+ if UuidCreate(_buffer) == 0: - return UUID(bytes=_buffer.raw).node - - def _random_getnode(): -@@ -546,9 +564,12 @@ def uuid1(node=None, clock_seq=None): - - # When the system provides a version-1 UUID generator, use it (but don't - # use UuidCreate here because its UUIDs don't conform to RFC 4122). -- if _uuid_generate_time and node is clock_seq is None: -+ uuid_generate_time = _uuid_generate("uuid_generate_time") -+ -+ if uuid_generate_time and node is clock_seq is None: -+ import ctypes - _buffer = ctypes.create_string_buffer(16) -- _uuid_generate_time(_buffer) -+ uuid_generate_time(_buffer) - return UUID(bytes=_buffer.raw) - - global _last_timestamp diff --git a/build/pkgs/python2/spkg-build.in b/build/pkgs/python2/spkg-build.in deleted file mode 120000 index ab563dea917..00000000000 --- a/build/pkgs/python2/spkg-build.in +++ /dev/null @@ -1 +0,0 @@ -../python3/spkg-build.in \ No newline at end of file diff --git a/build/pkgs/python2/spkg-check.in b/build/pkgs/python2/spkg-check.in deleted file mode 120000 index 68c37d2fdc8..00000000000 --- a/build/pkgs/python2/spkg-check.in +++ /dev/null @@ -1 +0,0 @@ -../python3/spkg-check.in \ No newline at end of file diff --git a/build/pkgs/python2/spkg-install.in b/build/pkgs/python2/spkg-install.in deleted file mode 120000 index 98b9bc31360..00000000000 --- a/build/pkgs/python2/spkg-install.in +++ /dev/null @@ -1 +0,0 @@ -../python3/spkg-install.in \ No newline at end of file diff --git a/build/pkgs/python2/type b/build/pkgs/python2/type deleted file mode 100644 index 134d9bc32d5..00000000000 --- a/build/pkgs/python2/type +++ /dev/null @@ -1 +0,0 @@ -optional