From 236dc9855eb49f8c25cdfa899f0b1ae2f87d26ad Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: May 20 2020 07:51:06 +0000 Subject: Rebased to 3.8.3 final --- diff --git a/00102-lib64.patch b/00102-lib64.patch index 3f59886..8824c39 100644 --- a/00102-lib64.patch +++ b/00102-lib64.patch @@ -1,5 +1,5 @@ diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py -index 0258d3d..4b969bf 100644 +index c625c95..ae4f915 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -30,14 +30,14 @@ WINDOWS_SCHEME = { @@ -20,10 +20,10 @@ index 0258d3d..4b969bf 100644 'scripts': '$base/bin', 'data' : '$base', diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py -index 0a034ee..3ce0dc1 100644 +index b51629e..9a4892a 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py -@@ -147,8 +147,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): +@@ -146,8 +146,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": @@ -53,10 +53,10 @@ index 287ab19..d4c05e0 100644 check_path(cmd.install_headers, os.path.join(destination, "include", "python", "foopkg")) diff --git a/Lib/site.py b/Lib/site.py -index 8786588..78bb790 100644 +index a065ab0..22d53fa 100644 --- a/Lib/site.py +++ b/Lib/site.py -@@ -334,11 +334,15 @@ def getsitepackages(prefixes=None): +@@ -335,11 +335,15 @@ def getsitepackages(prefixes=None): seen.add(prefix) if os.sep == '/': @@ -73,7 +73,7 @@ index 8786588..78bb790 100644 return sitepackages diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py -index d15cec8..159c78b 100644 +index b9e2faf..0ae6d35 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -20,10 +20,10 @@ __all__ = [ @@ -105,10 +105,10 @@ index d15cec8..159c78b 100644 'scripts': '{userbase}/bin', 'data': '{userbase}', diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py -index 568f81d..234cff8 100644 +index 1bbc697..9a7e80d 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py -@@ -269,8 +269,8 @@ class HelperFunctionsTests(unittest.TestCase): +@@ -267,8 +267,8 @@ class HelperFunctionsTests(unittest.TestCase): dirs = site.getsitepackages() if os.sep == '/': # OS X, Linux, FreeBSD, etc @@ -120,10 +120,10 @@ index 568f81d..234cff8 100644 'site-packages') self.assertEqual(dirs[0], wanted) diff --git a/Makefile.pre.in b/Makefile.pre.in -index beaccf5..bba49ca 100644 +index 5646b20..f5991b2 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -144,7 +144,7 @@ LIBDIR= @libdir@ +@@ -143,7 +143,7 @@ LIBDIR= @libdir@ MANDIR= @mandir@ INCLUDEDIR= @includedir@ CONFINCLUDEDIR= $(exec_prefix)/include @@ -133,28 +133,28 @@ index beaccf5..bba49ca 100644 # Detailed destination directories diff --git a/Modules/getpath.c b/Modules/getpath.c -index ba8d74b..198e8f0 100644 +index b727f66..a0c5fb6 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c -@@ -535,7 +535,7 @@ calculate_exec_prefix(const _PyCoreConfig *core_config, - "Could not find platform dependent libraries \n"); +@@ -730,7 +730,7 @@ calculate_exec_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig, + if (safe_wcscpy(exec_prefix, calculate->exec_prefix, exec_prefix_len) < 0) { + return PATHLEN_ERR(); + } +- status = joinpath(exec_prefix, L"lib/lib-dynload", exec_prefix_len); ++ status = joinpath(exec_prefix, L"lib64/lib-dynload", exec_prefix_len); + if (_PyStatus_EXCEPTION(status)) { + return status; + } +@@ -1067,7 +1067,7 @@ calculate_zip_path(PyCalculatePath *calculate, const wchar_t *prefix, + return PATHLEN_ERR(); } - wcsncpy(exec_prefix, calculate->exec_prefix, MAXPATHLEN); -- joinpath(exec_prefix, L"lib/lib-dynload"); -+ joinpath(exec_prefix, L"lib64/lib-dynload"); } - /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ - } -@@ -787,7 +787,7 @@ calculate_zip_path(PyCalculatePath *calculate, const wchar_t *prefix) - else { - wcsncpy(calculate->zip_path, calculate->prefix, MAXPATHLEN); +- status = joinpath(zip_path, L"lib/python00.zip", zip_path_len); ++ status = joinpath(zip_path, L"lib64/python00.zip", zip_path_len); + if (_PyStatus_EXCEPTION(status)) { + return status; } -- joinpath(calculate->zip_path, L"lib/python00.zip"); -+ joinpath(calculate->zip_path, L"lib64/python00.zip"); - - /* Replace "00" with version */ - size_t bufsz = wcslen(calculate->zip_path); -@@ -912,7 +912,7 @@ calculate_init(PyCalculatePath *calculate, +@@ -1197,7 +1197,7 @@ calculate_init(PyCalculatePath *calculate, const PyConfig *config) if (!calculate->exec_prefix) { return DECODE_LOCALE_ERR("EXEC_PREFIX define", len); } @@ -164,29 +164,29 @@ index ba8d74b..198e8f0 100644 return DECODE_LOCALE_ERR("EXEC_PREFIX define", len); } diff --git a/setup.py b/setup.py -index 88cff61..ecbf798 100644 +index b168ed4..8628b9d 100644 --- a/setup.py +++ b/setup.py -@@ -585,7 +585,7 @@ class PyBuildExt(build_ext): +@@ -649,7 +649,7 @@ class PyBuildExt(build_ext): # directories (i.e. '.' and 'Include') must be first. See issue # 10520. - if not cross_compiling: + if not CROSS_COMPILING: - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') + add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') # only change this for cross builds for 3.3, issues on Mageia - if cross_compiling: -@@ -891,11 +891,11 @@ class PyBuildExt(build_ext): + if CROSS_COMPILING: +@@ -953,11 +953,11 @@ class PyBuildExt(build_ext): elif curses_library: readline_libs.append(curses_library) - elif self.compiler.find_library_file(lib_dirs + + elif self.compiler.find_library_file(self.lib_dirs + - ['/usr/lib/termcap'], + ['/usr/lib64/termcap'], 'termcap'): readline_libs.append('termcap') - exts.append( Extension('readline', ['readline.c'], -- library_dirs=['/usr/lib/termcap'], -+ library_dirs=['/usr/lib64/termcap'], - extra_link_args=readline_extra_link_args, - libraries=readline_libs) ) + self.add(Extension('readline', ['readline.c'], +- library_dirs=['/usr/lib/termcap'], ++ library_dirs=['/usr/lib64/termcap'], + extra_link_args=readline_extra_link_args, + libraries=readline_libs)) else: diff --git a/00111-no-static-lib.patch b/00111-no-static-lib.patch index 4cce364..0e093c0 100644 --- a/00111-no-static-lib.patch +++ b/00111-no-static-lib.patch @@ -1,17 +1,17 @@ diff --git a/Makefile.pre.in b/Makefile.pre.in -index 0db0dd0..bd8f769 100644 +index 406a441..917303d 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -574,7 +574,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c +@@ -562,7 +562,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir) # Build the interpreter -$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) +$(BUILDPYTHON): Programs/python.o $(LDLIBRARY) $(PY3LIBRARY) - $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) platform: $(BUILDPYTHON) pybuilddir.txt -@@ -622,12 +622,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o +@@ -610,12 +610,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build @@ -21,19 +21,19 @@ index 0db0dd0..bd8f769 100644 - -rm -f $@ - $(AR) $(ARFLAGS) $@ $(LIBRARY_OBJS) - - libpython$(LDVERSION).so: $(LIBRARY_OBJS) + libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS) if test $(INSTSONAME) != $(LDLIBRARY); then \ - $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ -@@ -715,7 +709,7 @@ Modules/Setup: $(srcdir)/Modules/Setup.dist - echo "-----------------------------------------------"; \ - fi + $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \ +@@ -693,7 +687,7 @@ Makefile Modules/config.c: Makefile.pre \ + @echo "The Makefile was updated, you may need to re-run make." + -Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) +Programs/_testembed: Programs/_testembed.o $(LDLIBRARY) $(PY3LIBRARY) - $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) ############################################################################ -@@ -1483,17 +1477,6 @@ libainstall: @DEF_MAKE_RULE@ python-config +@@ -1557,17 +1551,6 @@ libainstall: @DEF_MAKE_RULE@ python-config else true; \ fi; \ done diff --git a/00155-avoid-ctypes-thunks.patch b/00155-avoid-ctypes-thunks.patch deleted file mode 100644 index f03890e..0000000 --- a/00155-avoid-ctypes-thunks.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -up Python-3.2.3/Lib/ctypes/__init__.py.rhbz814391 Python-3.2.3/Lib/ctypes/__init__.py ---- Python-3.2.3/Lib/ctypes/__init__.py.rhbz814391 2012-04-20 15:12:49.017867692 -0400 -+++ Python-3.2.3/Lib/ctypes/__init__.py 2012-04-20 15:15:09.501111408 -0400 -@@ -275,11 +275,6 @@ def _reset_cache(): - # _SimpleCData.c_char_p_from_param - POINTER(c_char).from_param = c_char_p.from_param - _pointer_type_cache[None] = c_void_p -- # XXX for whatever reasons, creating the first instance of a callback -- # function is needed for the unittests on Win64 to succeed. This MAY -- # be a compiler bug, since the problem occurs only when _ctypes is -- # compiled with the MS SDK compiler. Or an uninitialized variable? -- CFUNCTYPE(c_int)(lambda: None) - - def create_unicode_buffer(init, size=None): - """create_unicode_buffer(aString) -> character array diff --git a/00170-gc-assertions.patch b/00170-gc-assertions.patch index fb3ad85..f95ebe5 100644 --- a/00170-gc-assertions.patch +++ b/00170-gc-assertions.patch @@ -1,76 +1,8 @@ -diff --git a/Include/object.h b/Include/object.h -index c772dea..5729797 100644 ---- a/Include/object.h -+++ b/Include/object.h -@@ -1098,6 +1098,49 @@ PyAPI_FUNC(void) - _PyObject_DebugTypeStats(FILE *out); - #endif /* ifndef Py_LIMITED_API */ - -+/* -+ Define a pair of assertion macros. -+ -+ These work like the regular C assert(), in that they will abort the -+ process with a message on stderr if the given condition fails to hold, -+ but compile away to nothing if NDEBUG is defined. -+ -+ However, before aborting, Python will also try to call _PyObject_Dump() on -+ the given object. This may be of use when investigating bugs in which a -+ particular object is corrupt (e.g. buggy a tp_visit method in an extension -+ module breaking the garbage collector), to help locate the broken objects. -+ -+ The WITH_MSG variant allows you to supply an additional message that Python -+ will attempt to print to stderr, after the object dump. -+*/ -+#ifdef NDEBUG -+/* No debugging: compile away the assertions: */ -+#define PyObject_ASSERT_WITH_MSG(obj, expr, msg) ((void)0) -+#else -+/* With debugging: generate checks: */ -+#define PyObject_ASSERT_WITH_MSG(obj, expr, msg) \ -+ ((expr) \ -+ ? (void)(0) \ -+ : _PyObject_AssertFailed((obj), \ -+ (msg), \ -+ (__STRING(expr)), \ -+ (__FILE__), \ -+ (__LINE__), \ -+ (__PRETTY_FUNCTION__))) -+#endif -+ -+#define PyObject_ASSERT(obj, expr) \ -+ PyObject_ASSERT_WITH_MSG(obj, expr, NULL) -+ -+/* -+ Declare and define the entrypoint even when NDEBUG is defined, to avoid -+ causing compiler/linker errors when building extensions without NDEBUG -+ against a Python built with NDEBUG defined -+*/ -+PyAPI_FUNC(void) _PyObject_AssertFailed(PyObject *, const char *, -+ const char *, const char *, int, -+ const char *); -+ - #ifdef __cplusplus - } - #endif diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py -index 8d806db..dc8bb16 100644 +index f52db1e..b8e8db9 100644 --- a/Lib/test/test_gc.py +++ b/Lib/test/test_gc.py -@@ -1,10 +1,12 @@ - import unittest - from test.support import (verbose, refcount_test, run_unittest, - strip_python_stderr, cpython_only, start_threads, -- temp_dir, requires_type_collecting, TESTFN, unlink) -+ temp_dir, requires_type_collecting, TESTFN, unlink, -+ import_module) - from test.support.script_helper import assert_python_ok, make_script - - import sys -+import sysconfig - import time - import gc - import weakref -@@ -46,6 +48,8 @@ class GC_Detector(object): +@@ -49,6 +49,8 @@ class GC_Detector(object): # gc collects it. self.wr = weakref.ref(C1055820(666), it_happened) @@ -79,155 +11,11 @@ index 8d806db..dc8bb16 100644 @with_tp_del class Uncollectable(object): """Create a reference cycle with multiple __del__ methods. -@@ -878,6 +882,50 @@ class GCCallbackTests(unittest.TestCase): - self.assertEqual(len(gc.garbage), 0) - - -+ @unittest.skipIf(BUILD_WITH_NDEBUG, -+ 'built with -NDEBUG') -+ def test_refcount_errors(self): -+ self.preclean() -+ # Verify the "handling" of objects with broken refcounts -+ import_module("ctypes") #skip if not supported -+ -+ import subprocess -+ code = '''if 1: -+ a = [] -+ b = [a] -+ -+ # Simulate the refcount of "a" being too low (compared to the -+ # references held on it by live data), but keeping it above zero -+ # (to avoid deallocating it): -+ import ctypes -+ ctypes.pythonapi.Py_DecRef(ctypes.py_object(a)) -+ -+ # The garbage collector should now have a fatal error when it reaches -+ # the broken object: -+ import gc -+ gc.collect() -+ ''' -+ p = subprocess.Popen([sys.executable, "-c", code], -+ stdout=subprocess.PIPE, -+ stderr=subprocess.PIPE) -+ stdout, stderr = p.communicate() -+ p.stdout.close() -+ p.stderr.close() -+ # Verify that stderr has a useful error message: -+ self.assertRegex(stderr, -+ b'Modules/gcmodule.c:[0-9]+: visit_decref: Assertion "\(\(gc\)->gc.gc_refs >> \(1\)\) != 0" failed.') -+ self.assertRegex(stderr, -+ b'refcount was too small') -+ self.assertRegex(stderr, -+ b'object : \[\]') -+ self.assertRegex(stderr, -+ b'type : list') -+ self.assertRegex(stderr, -+ b'refcount: 1') -+ self.assertRegex(stderr, -+ b'address : 0x[0-9a-f]+') -+ -+ - class GCTogglingTests(unittest.TestCase): - def setUp(self): - gc.enable() diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c -index 4d701cb..388dd78 100644 +index 5a6a81d..1b95ae8 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c -@@ -239,7 +239,8 @@ update_refs(PyGC_Head *containers) - { - PyGC_Head *gc = containers->gc.gc_next; - for (; gc != containers; gc = gc->gc.gc_next) { -- assert(_PyGCHead_REFS(gc) == GC_REACHABLE); -+ PyObject_ASSERT(FROM_GC(gc), -+ _PyGCHead_REFS(gc) == GC_REACHABLE); - _PyGCHead_SET_REFS(gc, Py_REFCNT(FROM_GC(gc))); - /* Python's cyclic gc should never see an incoming refcount - * of 0: if something decref'ed to 0, it should have been -@@ -259,7 +260,8 @@ update_refs(PyGC_Head *containers) - * so serious that maybe this should be a release-build - * check instead of an assert? - */ -- assert(_PyGCHead_REFS(gc) != 0); -+ PyObject_ASSERT(FROM_GC(gc), -+ _PyGCHead_REFS(gc) != 0); - } - } - -@@ -274,7 +276,9 @@ visit_decref(PyObject *op, void *data) - * generation being collected, which can be recognized - * because only they have positive gc_refs. - */ -- assert(_PyGCHead_REFS(gc) != 0); /* else refcount was too small */ -+ PyObject_ASSERT_WITH_MSG(FROM_GC(gc), -+ _PyGCHead_REFS(gc) != 0, -+ "refcount was too small"); /* else refcount was too small */ - if (_PyGCHead_REFS(gc) > 0) - _PyGCHead_DECREF(gc); - } -@@ -334,9 +338,10 @@ visit_reachable(PyObject *op, PyGC_Head *reachable) - * If gc_refs == GC_UNTRACKED, it must be ignored. - */ - else { -- assert(gc_refs > 0 -- || gc_refs == GC_REACHABLE -- || gc_refs == GC_UNTRACKED); -+ PyObject_ASSERT(FROM_GC(gc), -+ gc_refs > 0 -+ || gc_refs == GC_REACHABLE -+ || gc_refs == GC_UNTRACKED); - } - } - return 0; -@@ -378,7 +383,7 @@ move_unreachable(PyGC_Head *young, PyGC_Head *unreachable) - */ - PyObject *op = FROM_GC(gc); - traverseproc traverse = Py_TYPE(op)->tp_traverse; -- assert(_PyGCHead_REFS(gc) > 0); -+ PyObject_ASSERT(op, _PyGCHead_REFS(gc) > 0); - _PyGCHead_SET_REFS(gc, GC_REACHABLE); - (void) traverse(op, - (visitproc)visit_reachable, -@@ -441,7 +446,7 @@ move_legacy_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) - for (gc = unreachable->gc.gc_next; gc != unreachable; gc = next) { - PyObject *op = FROM_GC(gc); - -- assert(IS_TENTATIVELY_UNREACHABLE(op)); -+ PyObject_ASSERT(op, IS_TENTATIVELY_UNREACHABLE(op)); - next = gc->gc.gc_next; - - if (has_legacy_finalizer(op)) { -@@ -517,7 +522,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old) - PyWeakReference **wrlist; - - op = FROM_GC(gc); -- assert(IS_TENTATIVELY_UNREACHABLE(op)); -+ PyObject_ASSERT(op, IS_TENTATIVELY_UNREACHABLE(op)); - next = gc->gc.gc_next; - - if (! PyType_SUPPORTS_WEAKREFS(Py_TYPE(op))) -@@ -538,9 +543,9 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old) - * the callback pointer intact. Obscure: it also - * changes *wrlist. - */ -- assert(wr->wr_object == op); -+ PyObject_ASSERT(wr->wr_object, wr->wr_object == op); - _PyWeakref_ClearRef(wr); -- assert(wr->wr_object == Py_None); -+ PyObject_ASSERT(wr->wr_object, wr->wr_object == Py_None); - if (wr->wr_callback == NULL) - continue; /* no callback */ - -@@ -574,7 +579,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old) - */ - if (IS_TENTATIVELY_UNREACHABLE(wr)) - continue; -- assert(IS_REACHABLE(wr)); -+ PyObject_ASSERT(op, IS_REACHABLE(wr)); - - /* Create a new reference so that wr can't go away - * before we can process it again. -@@ -583,7 +588,8 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old) +@@ -760,7 +760,8 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old) /* Move wr to wrcb_to_call, for the next pass. */ wrasgc = AS_GC(wr); @@ -237,75 +25,3 @@ index 4d701cb..388dd78 100644 next isn't, so they can't be the same */ gc_list_move(wrasgc, &wrcb_to_call); -@@ -599,11 +605,11 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old) - - gc = wrcb_to_call.gc.gc_next; - op = FROM_GC(gc); -- assert(IS_REACHABLE(op)); -- assert(PyWeakref_Check(op)); -+ PyObject_ASSERT(op, IS_REACHABLE(op)); -+ PyObject_ASSERT(op, PyWeakref_Check(op)); - wr = (PyWeakReference *)op; - callback = wr->wr_callback; -- assert(callback != NULL); -+ PyObject_ASSERT(op, callback != NULL); - - /* copy-paste of weakrefobject.c's handle_callback() */ - temp = PyObject_CallFunctionObjArgs(callback, wr, NULL); -@@ -717,12 +723,14 @@ check_garbage(PyGC_Head *collectable) - for (gc = collectable->gc.gc_next; gc != collectable; - gc = gc->gc.gc_next) { - _PyGCHead_SET_REFS(gc, Py_REFCNT(FROM_GC(gc))); -- assert(_PyGCHead_REFS(gc) != 0); -+ PyObject_ASSERT(FROM_GC(gc), -+ _PyGCHead_REFS(gc) != 0); - } - subtract_refs(collectable); - for (gc = collectable->gc.gc_next; gc != collectable; - gc = gc->gc.gc_next) { -- assert(_PyGCHead_REFS(gc) >= 0); -+ PyObject_ASSERT(FROM_GC(gc), -+ _PyGCHead_REFS(gc) >= 0); - if (_PyGCHead_REFS(gc) != 0) - return -1; - } -diff --git a/Objects/object.c b/Objects/object.c -index 220aa90..f6c7161 100644 ---- a/Objects/object.c -+++ b/Objects/object.c -@@ -2177,6 +2177,35 @@ _PyTrash_thread_destroy_chain(void) - --tstate->trash_delete_nesting; - } - -+PyAPI_FUNC(void) -+_PyObject_AssertFailed(PyObject *obj, const char *msg, const char *expr, -+ const char *file, int line, const char *function) -+{ -+ fprintf(stderr, -+ "%s:%d: %s: Assertion \"%s\" failed.\n", -+ file, line, function, expr); -+ if (msg) { -+ fprintf(stderr, "%s\n", msg); -+ } -+ -+ fflush(stderr); -+ -+ if (obj) { -+ /* This might succeed or fail, but we're about to abort, so at least -+ try to provide any extra info we can: */ -+ _PyObject_Dump(obj); -+ } -+ else { -+ fprintf(stderr, "NULL object\n"); -+ } -+ -+ fflush(stdout); -+ fflush(stderr); -+ -+ /* Terminate the process: */ -+ abort(); -+} -+ - #ifndef Py_TRACE_REFS - /* For Py_LIMITED_API, we need an out-of-line version of _Py_Dealloc. - Define this here, so we can undefine the macro. */ diff --git a/00189-use-rpm-wheels.patch b/00189-use-rpm-wheels.patch index 050e679..d388b93 100644 --- a/00189-use-rpm-wheels.patch +++ b/00189-use-rpm-wheels.patch @@ -1,16 +1,8 @@ diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py -index 4748ba4..fc02255 100644 +index 566fb2a..553343e 100644 --- a/Lib/ensurepip/__init__.py +++ b/Lib/ensurepip/__init__.py -@@ -1,16 +1,31 @@ -+import distutils.version -+import glob - import os - import os.path --import pkgutil - import sys - import tempfile - +@@ -8,10 +8,25 @@ import tempfile __all__ = ["version", "bootstrap"] @@ -19,7 +11,7 @@ index 4748ba4..fc02255 100644 -_SETUPTOOLS_VERSION = "41.2.0" +_wheels = {} --_PIP_VERSION = "19.2.3" + _PIP_VERSION = "19.2.3" +def _get_most_recent_wheel_version(pkg): + prefix = os.path.join(_WHEEL_DIR, "{}-".format(pkg)) + _wheels[pkg] = {} @@ -37,7 +29,8 @@ index 4748ba4..fc02255 100644 _PROJECTS = [ ("setuptools", _SETUPTOOLS_VERSION), -@@ -94,12 +105,9 @@ def _bootstrap(*, root=None, upgrade=False, user=False, +@@ -105,13 +120,10 @@ def _bootstrap(*, root=None, upgrade=False, user=False, + # additional paths that need added to sys.path additional_paths = [] for project, version in _PROJECTS: - wheel_name = "{}-{}-py2.py3-none-any.whl".format(project, version) diff --git a/00335-backport-pathfix-change.patch b/00335-backport-pathfix-change.patch deleted file mode 100644 index 92faf6e..0000000 --- a/00335-backport-pathfix-change.patch +++ /dev/null @@ -1,290 +0,0 @@ -commit b8f85fc797aeee09a50718f402e0c95e68467d50 -Author: Patrik Kopkan -Date: Mon Nov 4 10:45:49 2019 +0100 - - commit 211987de0de73e2747e14fcfa217b20c1ec7d817 - Author: Patrik Kopkan - Date: Fri Sep 6 15:09:43 2019 +0200 - - bpo-37064: add -a to Tools/Scripts/pathfix.py - - this option enables to add single literal - flag to kept flags - - commit 3f43ceff186da09978d0aff257bb18b8ac7611f7 - Author: Victor Stinner - Date: Thu Sep 5 18:09:46 2019 +0200 - - bpo-37064: Skip test_tools.test_pathfix if installed (GH-15705) - - If Python is installed, skip test_tools.test_pathfix test because - Tools/scripts/pathfix.py script is not installed. - - commit 50254ac4c179cb412e90682098c97db786143929 - Author: PatrikKopkan - Date: Thu Sep 5 16:54:54 2019 +0200 - - bpo-37064: Add option -k to Tools/scripts/pathfix.py (GH-15548) - - Add flag -k to pathscript.py script: preserve shebang flags - -diff --git a/Lib/test/test_tools/test_pathfix.py b/Lib/test/test_tools/test_pathfix.py -new file mode 100644 -index 0000000..ec36117 ---- /dev/null -+++ b/Lib/test/test_tools/test_pathfix.py -@@ -0,0 +1,129 @@ -+import os -+import subprocess -+import sys -+import unittest -+from test import support -+from test.test_tools import import_tool, scriptsdir, skip_if_missing -+ -+ -+# need Tools/script/ directory: skip if run on Python installed on the system -+skip_if_missing() -+ -+ -+class TestPathfixFunctional(unittest.TestCase): -+ script = os.path.join(scriptsdir, 'pathfix.py') -+ -+ def setUp(self): -+ self.addCleanup(support.unlink, support.TESTFN) -+ -+ def pathfix(self, shebang, pathfix_flags, exitcode=0, stdout='', stderr='', -+ directory=''): -+ if directory: -+ # bpo-38347: Test filename should contain lowercase, uppercase, -+ # "-", "_" and digits. -+ filename = os.path.join(directory, 'script-A_1.py') -+ pathfix_arg = directory -+ else: -+ filename = support.TESTFN -+ pathfix_arg = filename -+ -+ with open(filename, 'w', encoding='utf8') as f: -+ f.write(f'{shebang}\n' + 'print("Hello world")\n') -+ -+ proc = subprocess.run( -+ [sys.executable, self.script, -+ *pathfix_flags, '-n', pathfix_arg], -+ capture_output=True, text=1) -+ -+ if stdout == '' and proc.returncode == 0: -+ stdout = f'{filename}: updating\n' -+ self.assertEqual(proc.returncode, exitcode, proc) -+ self.assertEqual(proc.stdout, stdout, proc) -+ self.assertEqual(proc.stderr, stderr, proc) -+ -+ with open(filename, 'r', encoding='utf8') as f: -+ output = f.read() -+ -+ lines = output.split('\n') -+ self.assertEqual(lines[1:], ['print("Hello world")', '']) -+ new_shebang = lines[0] -+ -+ if proc.returncode != 0: -+ self.assertEqual(shebang, new_shebang) -+ -+ return new_shebang -+ -+ def test_recursive(self): -+ tmpdir = support.TESTFN + '.d' -+ self.addCleanup(support.rmtree, tmpdir) -+ os.mkdir(tmpdir) -+ expected_stderr = f"recursedown('{os.path.basename(tmpdir)}')\n" -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python', -+ ['-i', '/usr/bin/python3'], -+ directory=tmpdir, -+ stderr=expected_stderr), -+ '#! /usr/bin/python3') -+ -+ def test_pathfix(self): -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python', -+ ['-i', '/usr/bin/python3']), -+ '#! /usr/bin/python3') -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python -R', -+ ['-i', '/usr/bin/python3']), -+ '#! /usr/bin/python3') -+ -+ def test_pathfix_keeping_flags(self): -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python -R', -+ ['-i', '/usr/bin/python3', '-k']), -+ '#! /usr/bin/python3 -R') -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python', -+ ['-i', '/usr/bin/python3', '-k']), -+ '#! /usr/bin/python3') -+ -+ def test_pathfix_adding_flag(self): -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python', -+ ['-i', '/usr/bin/python3', '-a', 's']), -+ '#! /usr/bin/python3 -s') -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python -S', -+ ['-i', '/usr/bin/python3', '-a', 's']), -+ '#! /usr/bin/python3 -s') -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python -V', -+ ['-i', '/usr/bin/python3', '-a', 'v', '-k']), -+ '#! /usr/bin/python3 -vV') -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python', -+ ['-i', '/usr/bin/python3', '-a', 'Rs']), -+ '#! /usr/bin/python3 -Rs') -+ self.assertEqual( -+ self.pathfix( -+ '#! /usr/bin/env python -W default', -+ ['-i', '/usr/bin/python3', '-a', 's', '-k']), -+ '#! /usr/bin/python3 -sW default') -+ -+ def test_pathfix_adding_errors(self): -+ self.pathfix( -+ '#! /usr/bin/env python -E', -+ ['-i', '/usr/bin/python3', '-a', 'W default', '-k'], -+ exitcode=2, -+ stderr="-a option doesn't support whitespaces") -+ -+ -+if __name__ == '__main__': -+ unittest.main() -diff --git a/Misc/NEWS.d/next/Tools-Demos/2019-05-27-15-26-12.bpo-37064.k_SPW2.rst b/Misc/NEWS.d/next/Tools-Demos/2019-05-27-15-26-12.bpo-37064.k_SPW2.rst -new file mode 100644 -index 0000000..d1210e2 ---- /dev/null -+++ b/Misc/NEWS.d/next/Tools-Demos/2019-05-27-15-26-12.bpo-37064.k_SPW2.rst -@@ -0,0 +1,2 @@ -+Add option -k to pathscript.py script: preserve shebang flags. -+Add option -a to pathscript.py script: add flags. -diff --git a/Tools/scripts/pathfix.py b/Tools/scripts/pathfix.py -index 28ee428..127c2fe 100755 ---- a/Tools/scripts/pathfix.py -+++ b/Tools/scripts/pathfix.py -@@ -1,6 +1,6 @@ - #!/usr/bin/env python3 - --# Change the #! line occurring in Python scripts. The new interpreter -+# Change the #! line (shebang) occurring in Python scripts. The new interpreter - # pathname must be given with a -i option. - # - # Command line arguments are files or directories to be processed. -@@ -10,7 +10,13 @@ - # arguments). - # The original file is kept as a back-up (with a "~" attached to its name), - # -n flag can be used to disable this. --# -+ -+# Sometimes you may find shebangs with flags such as `#! /usr/bin/env python -si`. -+# Normally, pathfix overwrites the entire line, including the flags. -+# To change interpreter and keep flags from the original shebang line, use -k. -+# If you want to keep flags and add to them one single literal flag, use option -a. -+ -+ - # Undoubtedly you can do this using find and sed or perl, but this is - # a nice example of Python code that recurses down a directory tree - # and uses regular expressions. Also note several subtleties like -@@ -33,16 +39,21 @@ rep = sys.stdout.write - new_interpreter = None - preserve_timestamps = False - create_backup = True -+keep_flags = False -+add_flags = b'' - - - def main(): - global new_interpreter - global preserve_timestamps - global create_backup -- usage = ('usage: %s -i /interpreter -p -n file-or-directory ...\n' % -+ global keep_flags -+ global add_flags -+ -+ usage = ('usage: %s -i /interpreter -p -n -k -a file-or-directory ...\n' % - sys.argv[0]) - try: -- opts, args = getopt.getopt(sys.argv[1:], 'i:pn') -+ opts, args = getopt.getopt(sys.argv[1:], 'i:a:kpn') - except getopt.error as msg: - err(str(msg) + '\n') - err(usage) -@@ -54,6 +65,13 @@ def main(): - preserve_timestamps = True - if o == '-n': - create_backup = False -+ if o == '-k': -+ keep_flags = True -+ if o == '-a': -+ add_flags = a.encode() -+ if b' ' in add_flags: -+ err("-a option doesn't support whitespaces") -+ sys.exit(2) - if not new_interpreter or not new_interpreter.startswith(b'/') or \ - not args: - err('-i option or file-or-directory missing\n') -@@ -96,6 +114,7 @@ def recursedown(dirname): - if recursedown(fullname): bad = 1 - return bad - -+ - def fix(filename): - ## dbg('fix(%r)\n' % (filename,)) - try: -@@ -166,12 +185,43 @@ def fix(filename): - # Return success - return 0 - -+ -+def parse_shebang(shebangline): -+ shebangline = shebangline.rstrip(b'\n') -+ start = shebangline.find(b' -') -+ if start == -1: -+ return b'' -+ return shebangline[start:] -+ -+ -+def populate_flags(shebangline): -+ old_flags = b'' -+ if keep_flags: -+ old_flags = parse_shebang(shebangline) -+ if old_flags: -+ old_flags = old_flags[2:] -+ if not (old_flags or add_flags): -+ return b'' -+ # On Linux, the entire string following the interpreter name -+ # is passed as a single argument to the interpreter. -+ # e.g. "#! /usr/bin/python3 -W Error -s" runs "/usr/bin/python3 "-W Error -s" -+ # so shebang should have single '-' where flags are given and -+ # flag might need argument for that reasons adding new flags is -+ # between '-' and original flags -+ # e.g. #! /usr/bin/python3 -sW Error -+ return b' -' + add_flags + old_flags -+ -+ - def fixline(line): - if not line.startswith(b'#!'): - return line -+ - if b"python" not in line: - return line -- return b'#! ' + new_interpreter + b'\n' -+ -+ flags = populate_flags(line) -+ return b'#! ' + new_interpreter + flags + b'\n' -+ - - if __name__ == '__main__': - main() diff --git a/python3.spec b/python3.spec index 19884bf..63e71a9 100644 --- a/python3.spec +++ b/python3.spec @@ -2,10 +2,10 @@ # Top-level metadata # ================== -%global pybasever 3.7 +%global pybasever 3.8 # pybasever without the dot: -%global pyshortver 37 +%global pyshortver 38 Name: python3 Summary: Interpreter of the Python programming language @@ -13,7 +13,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well -%global general_version %{pybasever}.7 +%global general_version %{pybasever}.3 #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} @@ -234,14 +234,6 @@ Patch102: 00102-lib64.patch # Downstream only: not appropriate for upstream Patch111: 00111-no-static-lib.patch -# 00155 # -# Avoid allocating thunks in ctypes unless absolutely necessary, to avoid -# generating SELinux denials on "import ctypes" and "import uuid" when -# embedding Python within httpd -# See https://bugzilla.redhat.com/show_bug.cgi?id=814391 -Patch155: 00155-avoid-ctypes-thunks.patch - - # 00170 # # In debug builds, try to print repr() when a C-level assert fails in the # garbage collector (typically indicating a reference-counting error @@ -289,14 +281,6 @@ Patch316: 00316-mark-bdist_wininst-unsupported.patch # See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426 Patch328: 00328-pyc-timestamp-invalidation-mode.patch -# 00335 # -# Tools/scripts/pathfix.py backports -# Add -k and -a command line options to preserve and add shebang flags -# In upstream since 3.8: https://bugs.python.org/issue37064 -# Assume all .py files are Python scripts when working recursively: -# In upstream since 3.8: https://bugs.python.org/issue38347 -Patch335: 00335-backport-pathfix-change.patch - # (New patches go here ^^^) # @@ -622,7 +606,6 @@ rm -r Modules/expat %patch102 -p1 %endif %patch111 -p1 -%patch155 -p1 %patch170 -p1 %patch178 -p1 @@ -636,7 +619,6 @@ rm Lib/ensurepip/_bundled/*.whl %patch274 -p1 %patch316 -p1 %patch328 -p1 -%patch335 -p1 # Remove files that should be generated by the build @@ -1545,6 +1527,9 @@ CheckPython optimized # ====================================================== %changelog +* Fri May 15 2020 Miro Hrončok - 3.8.3-1 +- Rebased to 3.8.3 final + * Wed Mar 11 2020 Marcel Plch - 3.7.7-1 - Update to 3.7.7 - Update the ensurepip module to work with setuptools >= 45 diff --git a/sources b/sources index 56ebbd0..79d3eba 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (Python-3.7.7.tar.xz) = ddc838a7b0c442c2e465616f20231f2b703ed6b69ed2dc17858aac8760814fdf7cff43d350d359300e47b6bb1f0bd38c31126b855e423a3a65ed06a8fa16d136 -SHA512 (Python-3.7.7.tar.xz.asc) = e6437eec497aaa5c50e03d48f0e9fe7ed73b898b8eb4284878a774de2711979850469db80c20dbdf53f18a132f445ca3b06ee59fff2e138ca78e84cad50cdc5f +SHA512 (Python-3.8.3.tar.xz) = 3103bd8d944f3905eee3a2b52fd1f5c7dee380f9c5a99ad35a401fcba5a9117c3860ecec5cb47a92712c6549442fd2fa553a15c5657241dd09f5d00b9ed4f0f4 +SHA512 (Python-3.8.3.tar.xz.asc) = ab39e148475391e4e149ee3a8290e8ba872c758697a4a0b677585875695d107dfcc03a7ab51c5c5f42d65ef779121047a78c61e7789bb1ea7405f9b58aa420f1