From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74463 invoked by alias); 31 May 2018 14:12:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 74451 invoked by uid 89); 31 May 2018 14:12:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_20,KAM_NUMSUBJECT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=3x, UD:bugs.python.org, python.c, whomever X-HELO: esa6.dell-outbound.iphmx.com Received: from esa6.dell-outbound.iphmx.com (HELO esa6.dell-outbound.iphmx.com) (68.232.149.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 May 2018 14:12:48 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2FuAQBcAhBbmD+a6ERcGgEBAQEBAgEBA?= =?us-ascii?q?QEIAQEBAYQYDoEnCphTgXmBD5M8gXgLHw+EPgKCBSE2FgECAQEBAQEBAgEBAhA?= =?us-ascii?q?BAQEBAQgLCwYoIwyCNSIRS1wBAQEBAQEjAg1jAQEBAwE6PwULAgEIFAMBHhBPC?= =?us-ascii?q?AIEDgWDIgKBdwgPqSCIQ4FjBQkBiDWCE4EzgmmELEdMgmSCJAKMLIw8BwKFbIh?= =?us-ascii?q?0gTyDdIdiiXGHJIFIAYIDcFAqAYIYgiAOCYhZhT5vjnCBGQEB?= X-IPAS-Result: =?us-ascii?q?A2FuAQBcAhBbmD+a6ERcGgEBAQEBAgEBAQEIAQEBAYQYDoE?= =?us-ascii?q?nCphTgXmBD5M8gXgLHw+EPgKCBSE2FgECAQEBAQEBAgEBAhABAQEBAQgLCwYoI?= =?us-ascii?q?wyCNSIRS1wBAQEBAQEjAg1jAQEBAwE6PwULAgEIFAMBHhBPCAIEDgWDIgKBdwg?= =?us-ascii?q?PqSCIQ4FjBQkBiDWCE4EzgmmELEdMgmSCJAKMLIw8BwKFbIh0gTyDdIdiiXGHJ?= =?us-ascii?q?IFIAYIDcFAqAYIYgiAOCYhZhT5vjnCBGQEB?= Received: from esa3.dell-outbound2.iphmx.com ([68.232.154.63]) by esa6.dell-outbound.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 May 2018 09:12:46 -0500 From: Received: from ausxippc110.us.dell.com ([143.166.85.200]) by esa3.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 May 2018 20:05:28 +0600 X-LoopCount0: from 10.166.136.214 X-DLP: DLP_GlobalPCIDSS To: CC: , Subject: Re: GDB fails to build with Python 3.7 Date: Thu, 31 May 2018 14:43:00 -0000 Message-ID: <13790B97-BD92-48D1-B406-7D62E661C098@dell.com> References: <5e55cd3c-7ccd-4cce-5297-ddddadf91975@redhat.com> <20180530222629.642gog77pan2uzm5@adacore.com> In-Reply-To: <20180530222629.642gog77pan2uzm5@adacore.com> Content-Type: text/plain; charset="us-ascii" Content-ID: <8151BDF3F50CF64DB4D27859B82C3C64@dell.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2018-05/txt/msg00850.txt.bz2 > On May 30, 2018, at 6:26 PM, Joel Brobecker wrote: >=20 > Hi Paul, >=20 >> Currently GDB fails to build with Python 3.7 >>=20 >> https://bugs.python.org/issue33470 >>=20 >> This is because we use an internal Python API: >>=20 >> #ifdef IS_PY3K >> gdb_module =3D PyModule_Create (&python_GdbModuleDef); >> /* Add _gdb module to the list of known built-in modules. */ >> _PyImport_FixupBuiltin (gdb_module, "_gdb"); >> #else >> gdb_module =3D Py_InitModule ("_gdb", python_GdbMethods); >> #endif >>=20 >> (the _PyImport_FixupBuiltin in python.c). >>=20 >> 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. >=20 > From what I can tell, this was was introduced when you added > Python 3.x support, back in 2012: >=20 > commit 9a27f2c60d760a95a27e336750f26f69f91dd156 > Date: Wed Dec 12 16:47:30 2012 +0000 > Subject: Add support for Python 3 >=20 > Do you remember why you added that _PyImport_FixupBuiltin call? >=20 > If not, I suggest we just remove it and re-run the testsuite. > If we find regressions, then we'll have our answer. If we don't, > let's just remove the code, and see whether anyone finds something. I think it was because the PyModule_Create creates a module object, but it = doesn't make the module name known so references to it fail. The FixupBuil= tin call makes it a known module. At least that's what the comment suggest= s and it tickles a faint memory. The Python manuals aren't helping me here. But they suggest something that= I missed before, or maybe it wasn't documented at the time. The API call = PyImport_AppendInittab is used to add an entry to a table of compiled-in mo= dules (such as _gdb) that are to be initialized and made known as part of P= ython initialization. So it looks like the correct fix is to delete both s= tatements, and instead do a PyImport_AppendInittab before the Py_Initialize= call. I haven't been able to get gdb configure to recognize Python at all on my M= ac, unfortunately. paul