diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index fa0ec1e..fd18d2a 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -512,3 +512,7 @@ Patch122: gdb-rhbz1553104-s390x-arch12-test.patch # This patch should be removed on the next rebase. Patch123: gdb-aarch64-guard-sve-macros.patch +# Fix build breakage with Python 3.7 +# RHBZ #1577396 +Patch124: gdb-fix-python37-breakage.patch + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index 27a39b7..97f12c4 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -121,3 +121,4 @@ %patch121 -p1 %patch122 -p1 %patch123 -p1 +%patch124 -p1 diff --git a/_patch_order b/_patch_order index 0b3b3e8..d06db6d 100644 --- a/_patch_order +++ b/_patch_order @@ -121,3 +121,4 @@ gdb-archer.patch gdb-vla-intel-fix-print-char-array.patch gdb-rhbz1553104-s390x-arch12-test.patch gdb-aarch64-guard-sve-macros.patch +gdb-fix-python37-breakage.patch diff --git a/gdb-fix-python37-breakage.patch b/gdb-fix-python37-breakage.patch new file mode 100644 index 0000000..0c01f2d --- /dev/null +++ b/gdb-fix-python37-breakage.patch @@ -0,0 +1,68 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Paul Koning +Date: Fri, 8 Jun 2018 13:26:36 -0400 +Subject: gdb-fix-python37-breakage.patch + +FileName: gdb-fix-python37-breakage.patch + +;; Fix build breakage with Python 3.7 +;; RHBZ #1577396 + +Fix build issue with Python 3.7 + +Originally reported in +https://bugzilla.redhat.com/show_bug.cgi?id=1577396 -- gdb build fails +with Python 3.7 due to references to a Python internal function whose +declaration changed in 3.7. + +gdb/ChangeLog +2018-06-08 Paul Koning + + PR gdb/23252 + + * python/python.c (do_start_initialization): + Avoid call to internal Python API. + (init__gdb_module): New function. + +diff --git a/gdb/python/python.c b/gdb/python/python.c +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -1810,6 +1810,17 @@ finalize_python (void *ignore) + restore_active_ext_lang (previous_active); + } + ++#ifdef IS_PY3K ++/* This is called via the PyImport_AppendInittab mechanism called ++ during initialization, to make the built-in _gdb module known to ++ Python. */ ++PyMODINIT_FUNC ++init__gdb_module (void) ++{ ++ return PyModule_Create (&python_GdbModuleDef); ++} ++#endif ++ + static bool + do_start_initialization () + { +@@ -1850,6 +1861,9 @@ do_start_initialization () + remain alive for the duration of the program's execution, so + it is not freed after this call. */ + Py_SetProgramName (progname_copy); ++ ++ /* Define _gdb as a built-in module. */ ++ PyImport_AppendInittab ("_gdb", init__gdb_module); + #else + Py_SetProgramName (progname.release ()); + #endif +@@ -1859,9 +1873,7 @@ do_start_initialization () + PyEval_InitThreads (); + + #ifdef IS_PY3K +- gdb_module = PyModule_Create (&python_GdbModuleDef); +- /* Add _gdb module to the list of known built-in modules. */ +- _PyImport_FixupBuiltin (gdb_module, "_gdb"); ++ gdb_module = PyImport_ImportModule ("_gdb"); + #else + gdb_module = Py_InitModule ("_gdb", python_GdbMethods); + #endif diff --git a/gdb.spec b/gdb.spec index d98a473..6937d8c 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 8.1.50.%{snapsrc} # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 17%{?dist} +Release: 18%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL Group: Development/Debuggers @@ -1026,6 +1026,9 @@ then fi %changelog +* Fri Jun 8 2018 Sergio Durigan Junior - 8.1.50.20180605-18.fc29 +- Fix Python 3.7 breakage (RH BZ 1577396). + * Tue Jun 5 2018 Sergio Durigan Junior - 8.1.50.20180605-17.fc29 - Rebase to FSF GDB 8.1.50.20180605 (8.2pre).