* Re: [PATCH] fix build failure with Python 3.7 [not found] <96198491-96D8-42F0-9956-1C2BC9277050@dell.com> @ 2018-05-31 20:45 ` Sergio Durigan Junior 2018-05-31 21:25 ` Paul.Koning 0 siblings, 1 reply; 16+ messages in thread From: Sergio Durigan Junior @ 2018-05-31 20:45 UTC (permalink / raw) To: Paul.Koning; +Cc: gdb-patches On Thursday, May 31 2018, Paul Koning wrote: > This cures PR gdb/33470, build failure due to calling an internal > API in Python that changed in V3.7. The code now uses the > "inittab" mechanism in Python, which is the approved way to > make compiled-in modules known to Python. > > Gdb starts properly and I can see the _gdb module. On my test > system (a Mac) it's hard to get gdb to run at all, so the > test suite is a bit problematic. What other tests are needed? Thanks for the patch, Paul. I'll run this on BuildBot and see what comes out of it. Meanwhile... > paul > > gdb/ChangeLog: > > 2018-05-31 Paul Koning <paul_koning@dell.com> > > PR gdb/33470 This bug number is actually from Python's bugzilla, not GDB's. So it's not correct to mention it here in the ChangeLog/commit message. AFAIK, there's no correspondent GDB bug filed for this issue. > * python/python.c (do_start_initialization): > Avoid call to internal Python API. > (PyInit__gdb): New function. > > diff --git a/gdb/python/python.c b/gdb/python/python.c > index c29e7d7a6b..89443aee25 100644 > --- a/gdb/python/python.c > +++ b/gdb/python/python.c > @@ -1667,6 +1667,14 @@ finalize_python (void *ignore) > restore_active_ext_lang (previous_active); > } > > +#ifdef IS_PY3K > +PyMODINIT_FUNC > +PyInit__gdb (void) > +{ > + return PyModule_Create (&python_GdbModuleDef); > +} > +#endif I think it's a good idea to add a comment to this function. > + > static bool > do_start_initialization () > { > @@ -1707,6 +1715,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", PyInit__gdb); > #else > Py_SetProgramName (progname.release ()); > #endif > @@ -1716,9 +1727,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 -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-05-31 20:45 ` [PATCH] fix build failure with Python 3.7 Sergio Durigan Junior @ 2018-05-31 21:25 ` Paul.Koning 2018-06-01 1:27 ` Tom Tromey ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Paul.Koning @ 2018-05-31 21:25 UTC (permalink / raw) To: sergiodj; +Cc: gdb-patches > On May 31, 2018, at 4:10 PM, Sergio Durigan Junior <sergiodj@redhat.com> wrote: > >> >> gdb/ChangeLog: >> >> 2018-05-31 Paul Koning <paul_koning@dell.com> >> >> PR gdb/33470 > > This bug number is actually from Python's bugzilla, not GDB's. So it's > not correct to mention it here in the ChangeLog/commit message. AFAIK, > there's no correspondent GDB bug filed for this issue. Ok, I removed that. > >> * python/python.c (do_start_initialization): >> Avoid call to internal Python API. >> (PyInit__gdb): New function. >> >> diff --git a/gdb/python/python.c b/gdb/python/python.c >> index c29e7d7a6b..89443aee25 100644 >> --- a/gdb/python/python.c >> +++ b/gdb/python/python.c >> @@ -1667,6 +1667,14 @@ finalize_python (void *ignore) >> restore_active_ext_lang (previous_active); >> } >> >> +#ifdef IS_PY3K >> +PyMODINIT_FUNC >> +PyInit__gdb (void) >> +{ >> + return PyModule_Create (&python_GdbModuleDef); >> +} >> +#endif > > I think it's a good idea to add a comment to this function. I added this (after the #ifdef): /* This is called via the PyImport_AppendInittab mechanism called during initialization, to make the built-in _gdb module known to Python. */ paul ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-05-31 21:25 ` Paul.Koning @ 2018-06-01 1:27 ` Tom Tromey 2018-06-01 11:58 ` Phil Muldoon [not found] ` <87d0xb34jw.fsf@redhat.com> 2018-06-01 12:16 ` Pedro Alves 2 siblings, 1 reply; 16+ messages in thread From: Tom Tromey @ 2018-06-01 1:27 UTC (permalink / raw) To: Paul.Koning; +Cc: sergiodj, gdb-patches >>>>> <Paul.Koning@dell.com> writes: >> This bug number is actually from Python's bugzilla, not GDB's. So it's >> not correct to mention it here in the ChangeLog/commit message. AFAIK, >> there's no correspondent GDB bug filed for this issue. > Ok, I removed that. There may be other cases where we stick a URL of some non-gdb bug into the ChangeLog (or at least the commit message), and that seems like it would save some time for some future archaeologist, so I'd suggest doing that. Tom ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-01 1:27 ` Tom Tromey @ 2018-06-01 11:58 ` Phil Muldoon 0 siblings, 0 replies; 16+ messages in thread From: Phil Muldoon @ 2018-06-01 11:58 UTC (permalink / raw) To: Tom Tromey, Paul.Koning; +Cc: sergiodj, gdb-patches On 01/06/18 02:27, Tom Tromey wrote: >>>>>> <Paul.Koning@dell.com> writes: > >>> This bug number is actually from Python's bugzilla, not GDB's. So it's >>> not correct to mention it here in the ChangeLog/commit message. AFAIK, >>> there's no correspondent GDB bug filed for this issue. > >> Ok, I removed that. > > There may be other cases where we stick a URL of some non-gdb bug into > the ChangeLog (or at least the commit message), and that seems like it > would save some time for some future archaeologist, so I'd suggest doing > that. > > Tom > Hi all, I think the best thing to do would be to create a GDB bug that then has a reference to the Python bug tracking system. There is a Red Hat bugzilla entry for this, but from an upstream perspective, that's neither here nor there. Cheers, Phil ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <87d0xb34jw.fsf@redhat.com>]
* Re: [PATCH] fix build failure with Python 3.7 [not found] ` <87d0xb34jw.fsf@redhat.com> @ 2018-06-01 11:56 ` Phil Muldoon 0 siblings, 0 replies; 16+ messages in thread From: Phil Muldoon @ 2018-06-01 11:56 UTC (permalink / raw) To: Sergio Durigan Junior, Paul.Koning; +Cc: gdb-patches On 31/05/18 22:20, Sergio Durigan Junior wrote: > On Thursday, May 31 2018, Paul Koning wrote: > >>> On May 31, 2018, at 4:10 PM, Sergio Durigan Junior <sergiodj@redhat.com> wrote: >>> >>>> >>>> gdb/ChangeLog: >>>> >>>> 2018-05-31 Paul Koning <paul_koning@dell.com> >>>> >>>> PR gdb/33470 >>> >>> This bug number is actually from Python's bugzilla, not GDB's. So it's >>> not correct to mention it here in the ChangeLog/commit message. AFAIK, >>> there's no correspondent GDB bug filed for this issue. >> >> Ok, I removed that. >> >>> >>>> * python/python.c (do_start_initialization): >>>> Avoid call to internal Python API. >>>> (PyInit__gdb): New function. >>>> >>>> diff --git a/gdb/python/python.c b/gdb/python/python.c >>>> index c29e7d7a6b..89443aee25 100644 >>>> --- a/gdb/python/python.c >>>> +++ b/gdb/python/python.c >>>> @@ -1667,6 +1667,14 @@ finalize_python (void *ignore) >>>> restore_active_ext_lang (previous_active); >>>> } >>>> >>>> +#ifdef IS_PY3K >>>> +PyMODINIT_FUNC >>>> +PyInit__gdb (void) >>>> +{ >>>> + return PyModule_Create (&python_GdbModuleDef); >>>> +} >>>> +#endif >>> >>> I think it's a good idea to add a comment to this function. >> >> I added this (after the #ifdef): >> >> /* This is called via the PyImport_AppendInittab mechanism called >> during initialization, to make the built-in _gdb module known to >> Python. */ > > Thanks. > > FWIW, I ran the full testsuite here and no regressions were found. > Hey Sergio, Thanks for doing this. Did you test it against a GDB built against 3.7 and a GDB build with a 2.x version of Python? Cheers Phil ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-05-31 21:25 ` Paul.Koning 2018-06-01 1:27 ` Tom Tromey [not found] ` <87d0xb34jw.fsf@redhat.com> @ 2018-06-01 12:16 ` Pedro Alves 2018-06-01 12:54 ` Paul.Koning 2 siblings, 1 reply; 16+ messages in thread From: Pedro Alves @ 2018-06-01 12:16 UTC (permalink / raw) To: Paul.Koning, sergiodj; +Cc: gdb-patches On 05/31/2018 09:45 PM, Paul.Koning@dell.com wrote: >>> @@ -1667,6 +1667,14 @@ finalize_python (void *ignore) >>> restore_active_ext_lang (previous_active); >>> } >>> >>> +#ifdef IS_PY3K >>> +PyMODINIT_FUNC >>> +PyInit__gdb (void) >>> +{ >>> + return PyModule_Create (&python_GdbModuleDef); >>> +} >>> +#endif >> >> I think it's a good idea to add a comment to this function. > > I added this (after the #ifdef): > > /* This is called via the PyImport_AppendInittab mechanism called > during initialization, to make the built-in _gdb module known to > Python. */ Can the function be made static? I'm a little surprised to see the function being named "Py...", since that kind of looks like stepping in Python's namespace. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-01 12:16 ` Pedro Alves @ 2018-06-01 12:54 ` Paul.Koning 2018-06-01 13:10 ` Pedro Alves 0 siblings, 1 reply; 16+ messages in thread From: Paul.Koning @ 2018-06-01 12:54 UTC (permalink / raw) To: palves; +Cc: sergiodj, gdb-patches > On Jun 1, 2018, at 8:15 AM, Pedro Alves <palves@redhat.com> wrote: > > On 05/31/2018 09:45 PM, Paul.Koning@dell.com wrote: > >>>> @@ -1667,6 +1667,14 @@ finalize_python (void *ignore) >>>> restore_active_ext_lang (previous_active); >>>> } >>>> >>>> +#ifdef IS_PY3K >>>> +PyMODINIT_FUNC >>>> +PyInit__gdb (void) >>>> +{ >>>> + return PyModule_Create (&python_GdbModuleDef); >>>> +} >>>> +#endif >>> >>> I think it's a good idea to add a comment to this function. >> >> I added this (after the #ifdef): >> >> /* This is called via the PyImport_AppendInittab mechanism called >> during initialization, to make the built-in _gdb module known to >> Python. */ > > Can the function be made static? No; I did that first but PyMODINIT_FUNC is a #define that conflicts with "static". > I'm a little surprised to see the function being named "Py...", since > that kind of looks like stepping in Python's namespace. True. How about "init__gdb_module"? paul ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-01 12:54 ` Paul.Koning @ 2018-06-01 13:10 ` Pedro Alves 2018-06-01 13:22 ` Paul.Koning 0 siblings, 1 reply; 16+ messages in thread From: Pedro Alves @ 2018-06-01 13:10 UTC (permalink / raw) To: Paul.Koning; +Cc: sergiodj, gdb-patches On 06/01/2018 01:54 PM, Paul.Koning@dell.com wrote: >> Can the function be made static? > > No; I did that first but PyMODINIT_FUNC is a #define that conflicts with "static". I see. >> I'm a little surprised to see the function being named "Py...", since >> that kind of looks like stepping in Python's namespace. > > True. How about "init__gdb_module"? Sounds fine to me. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-01 13:10 ` Pedro Alves @ 2018-06-01 13:22 ` Paul.Koning 2018-06-01 13:36 ` Pedro Alves 0 siblings, 1 reply; 16+ messages in thread From: Paul.Koning @ 2018-06-01 13:22 UTC (permalink / raw) To: palves; +Cc: sergiodj, gdb-patches Ok, here is the patch in its current state. Ok to commit? paul gdb/ChangeLog: 2018-06-01 Paul Koning <paul_koning@dell.com> * 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 index c29e7d7a6b..dbd2f1ab2d 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1667,6 +1667,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 () { @@ -1707,6 +1718,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 @@ -1716,9 +1730,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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-01 13:22 ` Paul.Koning @ 2018-06-01 13:36 ` Pedro Alves 2018-06-01 13:37 ` Pedro Alves 0 siblings, 1 reply; 16+ messages in thread From: Pedro Alves @ 2018-06-01 13:36 UTC (permalink / raw) To: Paul.Koning; +Cc: sergiodj, gdb-patches On 06/01/2018 02:22 PM, Paul.Koning@dell.com wrote: > Ok, here is the patch in its current state. Ok to commit? Yes, but recall to include the rationale in the git commit log, and to include the link to the original Python issue in there. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-01 13:36 ` Pedro Alves @ 2018-06-01 13:37 ` Pedro Alves 2018-06-01 13:47 ` Paul.Koning 0 siblings, 1 reply; 16+ messages in thread From: Pedro Alves @ 2018-06-01 13:37 UTC (permalink / raw) To: Paul.Koning; +Cc: sergiodj, gdb-patches On 06/01/2018 02:36 PM, Pedro Alves wrote: > On 06/01/2018 02:22 PM, Paul.Koning@dell.com wrote: >> Ok, here is the patch in its current state. Ok to commit? > > Yes, but recall to include the rationale in the git commit log, and > to include the link to the original Python issue in there. Actually, should this go to the 8.1 branch too? If so, then per standard procedure we will indeed need a GDB bugzilla bug filed (and then a reference added to the ChangeLog). Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-01 13:37 ` Pedro Alves @ 2018-06-01 13:47 ` Paul.Koning [not found] ` <b1db3ded-7053-3d2b-773e-31ecd20efd90@redhat.com> 0 siblings, 1 reply; 16+ messages in thread From: Paul.Koning @ 2018-06-01 13:47 UTC (permalink / raw) To: palves; +Cc: sergiodj, gdb-patches > On Jun 1, 2018, at 9:37 AM, Pedro Alves <palves@redhat.com> wrote: > > On 06/01/2018 02:36 PM, Pedro Alves wrote: >> On 06/01/2018 02:22 PM, Paul.Koning@dell.com wrote: >>> Ok, here is the patch in its current state. Ok to commit? >> >> Yes, but recall to include the rationale in the git commit log, and >> to include the link to the original Python issue in there. > > Actually, should this go to the 8.1 branch too? If so, then per > standard procedure we will indeed need a GDB bugzilla bug filed > (and then a reference added to the ChangeLog). I opened the bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23252 paul ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <b1db3ded-7053-3d2b-773e-31ecd20efd90@redhat.com>]
* Re: [PATCH] fix build failure with Python 3.7 [not found] ` <b1db3ded-7053-3d2b-773e-31ecd20efd90@redhat.com> @ 2018-06-08 14:37 ` Paul.Koning 2018-06-08 14:55 ` Pedro Alves 0 siblings, 1 reply; 16+ messages in thread From: Paul.Koning @ 2018-06-08 14:37 UTC (permalink / raw) To: palves; +Cc: sergiodj, gdb-patches > On Jun 8, 2018, at 10:35 AM, Pedro Alves <palves@redhat.com> wrote: > > Hi Paul, > On 06/01/2018 02:47 PM, Paul.Koning@dell.com wrote: >> >> >>> On Jun 1, 2018, at 9:37 AM, Pedro Alves <palves@redhat.com> wrote: >>> >>> On 06/01/2018 02:36 PM, Pedro Alves wrote: >>>> On 06/01/2018 02:22 PM, Paul.Koning@dell.com wrote: >>>>> Ok, here is the patch in its current state. Ok to commit? >>>> >>>> Yes, but recall to include the rationale in the git commit log, and >>>> to include the link to the original Python issue in there. >>> >>> Actually, should this go to the 8.1 branch too? If so, then per >>> standard procedure we will indeed need a GDB bugzilla bug filed >>> (and then a reference added to the ChangeLog). >> >> I opened the bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23252 > Thanks. AFAICT, everything's sorted out. Anything holding this back? Just waiting for approval to commit. paul ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-08 14:37 ` Paul.Koning @ 2018-06-08 14:55 ` Pedro Alves 2018-06-08 17:36 ` Paul.Koning 0 siblings, 1 reply; 16+ messages in thread From: Pedro Alves @ 2018-06-08 14:55 UTC (permalink / raw) To: Paul.Koning; +Cc: sergiodj, gdb-patches On 06/08/2018 03:37 PM, Paul.Koning@dell.com wrote: >> Thanks. AFAICT, everything's sorted out. Anything holding this back? > > Just waiting for approval to commit. > Ah, but you already have it: https://sourceware.org/ml/gdb-patches/2018-06/msg00015.html Sorry if that wasn't clear. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-08 14:55 ` Pedro Alves @ 2018-06-08 17:36 ` Paul.Koning 2018-06-09 0:26 ` Sergio Durigan Junior 0 siblings, 1 reply; 16+ messages in thread From: Paul.Koning @ 2018-06-08 17:36 UTC (permalink / raw) To: palves; +Cc: sergiodj, gdb-patches > On Jun 8, 2018, at 10:55 AM, Pedro Alves <palves@redhat.com> wrote: > > On 06/08/2018 03:37 PM, Paul.Koning@dell.com wrote: > >>> Thanks. AFAICT, everything's sorted out. Anything holding this back? >> >> Just waiting for approval to commit. >> > > Ah, but you already have it: > > https://sourceware.org/ml/gdb-patches/2018-06/msg00015.html > > Sorry if that wasn't clear. > > Thanks, > Pedro Alves It was clear, but I managed to overlook the original message. I committed the patch with a commit message that references the original (Red Hat) bug. paul ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] fix build failure with Python 3.7 2018-06-08 17:36 ` Paul.Koning @ 2018-06-09 0:26 ` Sergio Durigan Junior 0 siblings, 0 replies; 16+ messages in thread From: Sergio Durigan Junior @ 2018-06-09 0:26 UTC (permalink / raw) To: Paul.Koning; +Cc: palves, gdb-patches On Friday, June 08 2018, Paul Koning wrote: >> On Jun 8, 2018, at 10:55 AM, Pedro Alves <palves@redhat.com> wrote: >> >> On 06/08/2018 03:37 PM, Paul.Koning@dell.com wrote: >> >>>> Thanks. AFAICT, everything's sorted out. Anything holding this back? >>> >>> Just waiting for approval to commit. >>> >> >> Ah, but you already have it: >> >> https://sourceware.org/ml/gdb-patches/2018-06/msg00015.html >> >> Sorry if that wasn't clear. >> >> Thanks, >> Pedro Alves > > It was clear, but I managed to overlook the original message. > > I committed the patch with a commit message that references the original (Red Hat) bug. Thanks, Paul. I've made a Fedora GDB release containing the patch now. -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/ ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2018-06-09 0:26 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <96198491-96D8-42F0-9956-1C2BC9277050@dell.com>
2018-05-31 20:45 ` [PATCH] fix build failure with Python 3.7 Sergio Durigan Junior
2018-05-31 21:25 ` Paul.Koning
2018-06-01 1:27 ` Tom Tromey
2018-06-01 11:58 ` Phil Muldoon
[not found] ` <87d0xb34jw.fsf@redhat.com>
2018-06-01 11:56 ` Phil Muldoon
2018-06-01 12:16 ` Pedro Alves
2018-06-01 12:54 ` Paul.Koning
2018-06-01 13:10 ` Pedro Alves
2018-06-01 13:22 ` Paul.Koning
2018-06-01 13:36 ` Pedro Alves
2018-06-01 13:37 ` Pedro Alves
2018-06-01 13:47 ` Paul.Koning
[not found] ` <b1db3ded-7053-3d2b-773e-31ecd20efd90@redhat.com>
2018-06-08 14:37 ` Paul.Koning
2018-06-08 14:55 ` Pedro Alves
2018-06-08 17:36 ` Paul.Koning
2018-06-09 0:26 ` Sergio Durigan Junior
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox