* Re: GDB fails to build with Python 3.7
[not found] ` <20180530222629.642gog77pan2uzm5@adacore.com>
@ 2018-05-31 17:28 ` Paul.Koning
0 siblings, 0 replies; 4+ messages in thread
From: Paul.Koning @ 2018-05-31 17:28 UTC (permalink / raw)
To: brobecker; +Cc: pmuldoon, gdb
> On May 30, 2018, at 6:26 PM, Joel Brobecker <brobecker@adacore.com> wrote:
>
> From what I can tell, this was was introduced when you added
> Python 3.x support, back in 2012:
>
> commit 9a27f2c60d760a95a27e336750f26f69f91dd156
> Date: Wed Dec 12 16:47:30 2012 +0000
> Subject: Add support for Python 3
>
> Do you remember why you added that _PyImport_FixupBuiltin call?
I just submitted a proposed patch for this. It's pretty easy, I'm not
sure how I missed it originally. Possible the documentation has
improved in the meantime.
paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* GDB fails to build with Python 3.7
@ 2018-05-29 11:37 Phil Muldoon
2018-05-29 12:11 ` Paul.Koning
0 siblings, 1 reply; 4+ messages in thread
From: Phil Muldoon @ 2018-05-29 11:37 UTC (permalink / raw)
To: gdb
Currently GDB fails to build with Python 3.7
https://bugs.python.org/issue33470
This is because we use an internal Python API:
#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");
#else
gdb_module = Py_InitModule ("_gdb", python_GdbMethods);
#endif
(the _PyImport_FixupBuiltin in python.c).
This internal API has been changed. According to the advice of the Python
maintainers we should never have used it in the first place. I didn't
add this (at least I don't think I did!), so I'm asking whomever
authored that code to please change it to be 3.7 compatible. I'm not
sure what the code achieves so I'm reluctant to touch it in case of
breakages on platforms I don't have easily access to.
Cheers
Phil
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: GDB fails to build with Python 3.7
2018-05-29 11:37 Phil Muldoon
@ 2018-05-29 12:11 ` Paul.Koning
2018-05-29 12:55 ` Phil Muldoon
0 siblings, 1 reply; 4+ messages in thread
From: Paul.Koning @ 2018-05-29 12:11 UTC (permalink / raw)
To: pmuldoon; +Cc: gdb
> On May 29, 2018, at 7:37 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
>
> Currently GDB fails to build with Python 3.7
>
> https://bugs.python.org/issue33470
>
> This is because we use an internal Python API:
>
> #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");
> #else
> gdb_module = Py_InitModule ("_gdb", python_GdbMethods);
> #endif
>
> (the _PyImport_FixupBuiltin in python.c).
>
> This internal API has been changed. According to the advice of the Python
> maintainers we should never have used it in the first place. I didn't
> add this (at least I don't think I did!), so I'm asking whomever
> authored that code to please change it to be 3.7 compatible. I'm not
> sure what the code achieves so I'm reluctant to touch it in case of
> breakages on platforms I don't have easily access to.
That may be part of my original Python 3 support work. I'd have to
dig back in somewhat dusty memories to find the reason. Part of the
problem is that Python initialization is different in Python 3 and
the differences are (or were?) undocumented and not particularly obvious.
I'll take a look. Right now I can't get configure to find Python at
all on my Mac -- "--with-python=/Library/Frameworks...." isn't doing it.
paul
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: GDB fails to build with Python 3.7
2018-05-29 12:11 ` Paul.Koning
@ 2018-05-29 12:55 ` Phil Muldoon
0 siblings, 0 replies; 4+ messages in thread
From: Phil Muldoon @ 2018-05-29 12:55 UTC (permalink / raw)
To: Paul.Koning; +Cc: gdb
On 29/05/18 13:11, Paul.Koning@dell.com wrote:
>
>
>> On May 29, 2018, at 7:37 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
>>
>> Currently GDB fails to build with Python 3.7
>>
>> https://bugs.python.org/issue33470
>>
>> This is because we use an internal Python API:
>>
>> #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");
>> #else
>> gdb_module = Py_InitModule ("_gdb", python_GdbMethods);
>> #endif
>>
>> (the _PyImport_FixupBuiltin in python.c).
>>
>> This internal API has been changed. According to the advice of the Python
>> maintainers we should never have used it in the first place. I didn't
>> add this (at least I don't think I did!), so I'm asking whomever
>> authored that code to please change it to be 3.7 compatible. I'm not
>> sure what the code achieves so I'm reluctant to touch it in case of
>> breakages on platforms I don't have easily access to.
>
> That may be part of my original Python 3 support work. I'd have to
> dig back in somewhat dusty memories to find the reason. Part of the
> problem is that Python initialization is different in Python 3 and
> the differences are (or were?) undocumented and not particularly obvious.
>
> I'll take a look. Right now I can't get configure to find Python at
> all on my Mac -- "--with-python=/Library/Frameworks...." isn't doing it.
>
> paul
>
> BUILDSTDERR: ../../gdb/python/python.c:1853:45: error: too few arguments to function 'int _PyImport_FixupBuiltin(PyObject*, const char*, PyObject*)'
Paul,
Thanks! And gah, I forgot to add the developers comments:
"This is a private API, gdb should not use it. I don't know why gdb
chose to call a private function.
To fix gdb, an #ifdef using PY_VERSION_HEX should be use to pass one
more additional parameter to Python 3.7: "modules". This parameter can
be found in interp->modules, where interp is the current
interpreter. For example, use PyThreadState_Get()->interp to get the
current interpreter."
Cheers
Phil
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-31 17:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <5e55cd3c-7ccd-4cce-5297-ddddadf91975@redhat.com>
[not found] ` <20180530222629.642gog77pan2uzm5@adacore.com>
2018-05-31 17:28 ` GDB fails to build with Python 3.7 Paul.Koning
2018-05-29 11:37 Phil Muldoon
2018-05-29 12:11 ` Paul.Koning
2018-05-29 12:55 ` Phil Muldoon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox