From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MZQJD0LweGklQRgAWB0awg (envelope-from ) for ; Tue, 27 Jan 2026 12:05:06 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=JaICcbv8; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=JaICcbv8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 359F61E08D; Tue, 27 Jan 2026 12:05:06 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 57EA11E08D for ; Tue, 27 Jan 2026 12:05:05 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id D5E9D4BA2E3E for ; Tue, 27 Jan 2026 17:05:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5E9D4BA2E3E Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=JaICcbv8; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=JaICcbv8 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazlp170100001.outbound.protection.outlook.com [IPv6:2a01:111:f403:c201::1]) by sourceware.org (Postfix) with ESMTPS id A5D254BAD171 for ; Tue, 27 Jan 2026 17:04:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A5D254BAD171 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A5D254BAD171 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c201::1 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1769533459; cv=pass; b=hzqyXJ0ac/EYzTvagRAFxrcOWkKeO6b06viCKCsguS+Cgh46x/axEU71KeoSf/FFQ0u4C9f40BLpGaYGF12jMUcyWUuU8Jv2eyiQ5mPGkO/I7nJ/hljpqT+wrMD6xeK6P3obxErmyJLOFhp+8q4GQIuNVVSc91EXJJUJEHL/ZMU= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1769533459; c=relaxed/simple; bh=X9j4q0Y+Hibz7eCxMAJdQ3qC6IMd+Ba204NtCfULweI=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=U15A75JAu/cHvJIkaK2OWnzJq2pb7lyNjfX5tt6iup5twIP7CWVuqtLxzm8xfatPnYmOnZWGYhHN+5Y+FuGjWWZ8inMfsxQHCi776sMvaeu/oHfX8GOCVsBl+x8v6MyGwOKNmpsq2p29IpcEidFL6xgHC3KI2J74pzs0CIUOaR8= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5D254BAD171 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=jTz3zo06jl6QNNtKscYqKbQe222mp0WMjstBmAnUdfCtHDniOhjq/cMyRu7/meivpwHxBWbCN+VDLbciGJBvJ9Yug+/xQlPwKLGuo3IZNAQTbUj+p9wdY9dYL+VLkqpVdyr31nH/6weAcJG68w12uPYyBsVRl4stC0GARVNXCIwVViiQn7aNRGGmsB1wTkCEVOr00jKc1/iVp6urx5pReBLkQul8SlClOv5oSfKc4U4YKmyX/GD0cjh0hKkl5QBnnLdpWR5n2Y5PKZMtFozKha+MtVvPwQnnRodD56J3LwM6Nus+ojvDbi+ZW6HgQdZ/fMb3AUfZm1YLDPudKu0Olg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YSfUBzq/7twkL8mRtsTKsZcvoqkt1JC2vtemeNjXtio=; b=pnPOuW3Np/RSgrZd8DX5eyKWBQAHsgHAOMxRMPu1ydoeViW3TP6jeuzo6BvtSi8lQf8ihWcdkYmoehzEgRvMf7siQBG1klV05uKg+WHgnjcSsitmu770TUpMa249CjacMW982qJkkwIUSNVaprN6EPsU77V1eh4hvDHDUnzSXDNgZo5+HkVheMkxfGgxMAPvPef3WjrQldZkBEaTmcbAjz69qRjs8qla9mUmo6zvSv8mTdIeLD4rzHTmgRPNccXgBqGL2hyzuenKVcCc5yd8NQ8XutlLJWwJxCTitSQZ3PCcIyIzKJZs5pv2fiwz0KTUB3kwicmLxFcZNrO6c8NvUg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YSfUBzq/7twkL8mRtsTKsZcvoqkt1JC2vtemeNjXtio=; b=JaICcbv8fuA0F+XSkeSuTdDsuRo/CqEWfmZGUPky4f2cGf22vYDOzpPL3nUTeWF8OVAxEwnxsxJmUaBFq+rSpHVVuC4Myz7Zm5ylJrNm4GyDhdPWD/WF/z0MHaxpN/e3nu/PN7bERnmwGYYMCQSvaGJN5NAi/QvYsR2rHxXX274= Received: from AS4P191CA0004.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::10) by DB9PR08MB11547.eurprd08.prod.outlook.com (2603:10a6:10:606::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.16; Tue, 27 Jan 2026 17:04:15 +0000 Received: from AM4PEPF00025F95.EURPRD83.prod.outlook.com (2603:10a6:20b:5d5:cafe::3d) by AS4P191CA0004.outlook.office365.com (2603:10a6:20b:5d5::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.16 via Frontend Transport; Tue, 27 Jan 2026 17:04:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by AM4PEPF00025F95.mail.protection.outlook.com (10.167.16.4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9587.0 via Frontend Transport; Tue, 27 Jan 2026 17:04:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mt97vgAdC3jEY5jD0UGY1knFD7WR/DDHm1bDIyFwRqbYY2DTpzN4oYk2v6ZFILCMnUzFaNpSYhIbw9f2I9rD7A7cjY0+cjUzeb+7SXAvVgzPRJEgm/NNtKhSl2IBwamtPyFLhqzSv46yzrlxoBfHTwVB439bTdUAnuZ7IHwTNjCYMMQuZVMHhItq+X5xsJxohRXaYwdtsNLu/B7uSLMEIw6tguoesMhVUpUSsegDp8W3zLStMkbEf8wHt6tD1Dgh5qA1I99qjqek58Hk5T6KyJo4JsD64hyZVGBDxC2LtQHWYJsIukRCNEwPvo2nnK279mqUME/XRQVUczK/JHko0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YSfUBzq/7twkL8mRtsTKsZcvoqkt1JC2vtemeNjXtio=; b=kp1gSw6/sgvCjbt6E2HFyt1vjf731MoV5xVE1dCJymXCo2RC5Xo7HWY3UPdFDOKZr4v64U8ak0ZWaRDNyixYyevDlp99hnABmMSGP7r3zEtAb1Vs0F/lrwxSDICyhBMBT7XvyMapt0gJtqTDTAn4as9aZhFPU3RZRTviqaY+2yq+G6lrNXUM21+PBWCC7NtlfDf7xEz2rDGwLbN1mhq7Zyqcq9DSxT0zizkGN6RMgm6522ypJjrrDnr1WmrlKpEdLfM5oNxvBIDYyNBIXzmj/wi13oh7iDC46qBDwiXOghAehA3ZimClytXZD7Jg7aJkRvx8FWS3JXUACDCBK4t50A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 172.205.89.229) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YSfUBzq/7twkL8mRtsTKsZcvoqkt1JC2vtemeNjXtio=; b=JaICcbv8fuA0F+XSkeSuTdDsuRo/CqEWfmZGUPky4f2cGf22vYDOzpPL3nUTeWF8OVAxEwnxsxJmUaBFq+rSpHVVuC4Myz7Zm5ylJrNm4GyDhdPWD/WF/z0MHaxpN/e3nu/PN7bERnmwGYYMCQSvaGJN5NAi/QvYsR2rHxXX274= Received: from DUZPR01CA0348.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b8::7) by AM0PR08MB11804.eurprd08.prod.outlook.com (2603:10a6:20b:747::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.15; Tue, 27 Jan 2026 17:03:10 +0000 Received: from DU6PEPF0000A7DE.eurprd02.prod.outlook.com (2603:10a6:10:4b8:cafe::68) by DUZPR01CA0348.outlook.office365.com (2603:10a6:10:4b8::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9564.7 via Frontend Transport; Tue, 27 Jan 2026 17:03:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 172.205.89.229) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 172.205.89.229 as permitted sender) receiver=protection.outlook.com; client-ip=172.205.89.229; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (172.205.89.229) by DU6PEPF0000A7DE.mail.protection.outlook.com (10.167.8.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.3 via Frontend Transport; Tue, 27 Jan 2026 17:03:10 +0000 Received: from AZ-NEU-EX03.Arm.com (10.240.25.137) by AZ-NEU-EX04.Arm.com (10.240.25.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Tue, 27 Jan 2026 17:03:10 +0000 Received: from PF4S4363.arm.com (10.57.51.184) by mail.arm.com (10.240.25.137) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Tue, 27 Jan 2026 17:03:09 +0000 From: Matthieu Longo To: CC: Tom Tromey , Matthieu Longo Subject: [PATCH v2 5/6] gdb: cast all Python extension objects passed to gdbpy_ref_policy to PyObject* Date: Tue, 27 Jan 2026 17:02:14 +0000 Message-ID: <20260127170215.1803582-6-matthieu.longo@arm.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127170215.1803582-1-matthieu.longo@arm.com> References: <20260127170215.1803582-1-matthieu.longo@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU6PEPF0000A7DE:EE_|AM0PR08MB11804:EE_|AM4PEPF00025F95:EE_|DB9PR08MB11547:EE_ X-MS-Office365-Filtering-Correlation-Id: a3c7ff2f-f71c-4c7f-f2b9-08de5dc619f4 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024|13003099007; X-Microsoft-Antispam-Message-Info-Original: =?us-ascii?Q?B3aDJL0pJ7ZdHAqsgv9jda9Hbaje3FWYGb1CiR8yyLd7rEwzM+Fw3E3Bfgdw?= =?us-ascii?Q?hFLIFpZUdzEpqq+Z3opKcU/MOb2g1nRTXGmq7ZlMvalNPiEuClOIvc74zTyB?= =?us-ascii?Q?4UhwGnQa2CBjoXXAmBjmkC94tsntP1iq13zd21/TZcreuskP9JrB7HtA/g2J?= =?us-ascii?Q?r4Ld2QMkazf5SDtwqcelmFOmmWxFPBHahe0XxLDNNLE2uvTQHfm2GXXkXnf0?= =?us-ascii?Q?Qbl8qi2vMdgO+umo6fEXixrP7PB6l4BauJLE1/bznIH01ZmCDu6BLXsR8r3n?= =?us-ascii?Q?gHGCgYism2psniF7Ll+X/U+1oysjhJHwE516x3u5TghFMB1OXW4+7E757WAU?= =?us-ascii?Q?mq391hH96pXat+IeNzWCrgK9St1d605DdbQKFbrxF8yhpqBC5GyqE8vbq+Ql?= =?us-ascii?Q?zP7rjVKq3iTDjObBSDqHA0zYtDOkLXUS0MBprjp371FKWaWPzuvyF0lW2qq5?= =?us-ascii?Q?bN8BFiE5gtgpsLyo45VrWomZRbemebANHbvS4LWysi6GcNEXwRoMaP4mhKhG?= =?us-ascii?Q?5neidBRBsh/W3M3pZug4aTuVvZ1PiHb+jgYHi02HX082oVg84EZoPxJLrFHM?= =?us-ascii?Q?NcHX8vte0YfMkwYPiC2DLFF+gR5BZQR382SWuYfLennBTsU0LA6LkFwHIdAo?= =?us-ascii?Q?xMEDH7KN/w57NIxBiQU0Jyir2rpWdfWf6O51/32fgNGRJ6wkWFdX28IylPWJ?= =?us-ascii?Q?iSZRigp0+VubMH2T2GmbZxOkNrHmu1nHIGrbVZIF89GBXfKkyPiST7+D3GyB?= =?us-ascii?Q?vcxDD9m9OaQbKAN5fyukAT55pfy0sob5hYn8zrECotRkSUmOthE52IinH7E9?= =?us-ascii?Q?vDOLlmIcO+M+RC/CjpmEsXHiI7Yvn93SWo5wdf8BM2+3uXYzXJqJDlDsQ8tq?= =?us-ascii?Q?SdqdzU/L/Th3t2un1YroUuFM316LHDwsSt1B1C/k8qt7CpaaxySfMCll1YqQ?= =?us-ascii?Q?E2/BHmbRqqFIVm9OGo9m2OuS80jQlcPdl5RtmkzsSfC/dacdjp+4j3pnjZI+?= =?us-ascii?Q?RTCtW1QMxTbGUaXhJiaUGXEPw3dBv3y1lTLgQBxsVwZEnZ7R9XV5WMLazztZ?= =?us-ascii?Q?hg1X6wSM4ThVONhNdMFg29xfQF+6yLZN7b+dezAI+n40vpoWzU6zCx3TuQrX?= =?us-ascii?Q?9zWlIkH4ZeeXSpLgtn7/xkvH4WXLXEfcqoc3lqh2y9O+ZWQYpJAvrxUPlGDC?= =?us-ascii?Q?1ohB8g1dNbBcv3HGHYuZFozbwfBpd3+thlgSCPKmt5Lo3OVySfFwd1zFpLmt?= =?us-ascii?Q?TddTFyDRAzzXEbGg1fYgIEwNJOKfErK+CGFGUqGpkYUQqzzxxICUGbcp5OUC?= =?us-ascii?Q?a00jo99RNbj1visGq1LgHxP5gQWbZOybh7E4c5dk/ca3GMfg7XizRCgt5GP9?= =?us-ascii?Q?0SeebddcdQqSD52dsPOw30RHZqlfT+P8eLHCRMeJjifrJXlishcyMs2YrNxS?= =?us-ascii?Q?x+j6h8bV6F5K2q+q6dFj36cjqPVptsfWTG/A1FeQVxR1QfPXADCgJeyLiDAD?= =?us-ascii?Q?AXnmd8PBzwldM2M7L0WAbcsyxwMFcAuYkA2hms4yZbN6rRZ7KC2HV1Re6jNR?= =?us-ascii?Q?tbCYQfWku8URWwcfLLY4wXdThsAwdGhz7kAJtXDNQVlw4H36P/6C6wohg3pC?= =?us-ascii?Q?ZjwpzEROJ828wUGkNbijvLameAJww0J5VFGF5pw+/ddY/xXuSR4xLYFPBzIX?= =?us-ascii?Q?SR6Veg=3D=3D?= X-Forefront-Antispam-Report-Untrusted: CIP:172.205.89.229; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024)(13003099007); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB11804 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM4PEPF00025F95.EURPRD83.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 315b8acf-f729-4aa4-d8a1-08de5dc5f36b X-Microsoft-Antispam: BCL:0; ARA:13230040|35042699022|376014|36860700013|14060799003|82310400026|1800799024|13003099007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?m0u0DWhcAQM0BjtU80WSUTv2jMZHW3CE2OYSw4MG5z4iJiJYgV7WRWxdTGcd?= =?us-ascii?Q?5uhA4oTb+9SYFUpfptkxJydk/QZ9q/qHhwdATuCQAGZBRLiAttdy9nOmyIt4?= =?us-ascii?Q?yNumTAAc+KXZsiJEexj5ooCtQuEOoaJ84n8OBtjiCYFYszvyBDvkDXCyCq08?= =?us-ascii?Q?GlF3r/qRna12kp7g7vYRqLUGSyGM6z9RdafapsLD/AqB0cksI3ZBbA+5teLK?= =?us-ascii?Q?VMZOOqd+YC4bK9ShUOz1/CGuRgSAUOOtW3G+cjzOUU8Ci1Ezv0JFvwj3tj+C?= =?us-ascii?Q?250mysKFRR9kgGZ2gynxG5+vIT2I1OHkZM93quM0NAF0F9gJTD7AMUorUyjd?= =?us-ascii?Q?6C+i3gt3HqejI1+QB9Z35v18ivP+OGDhDS1z1MkPU0hAPFIL0kajBPRzpDfR?= =?us-ascii?Q?ayusUjF3d9WyPgB39Lg1z1olOsV+0TgPn69wZSml9nbzeO0VHNxm0pRba7aj?= =?us-ascii?Q?m9UwLr/zhttMxEpjwy2THBYbw0UFBHtmcYhSw8iX7JUlnCakeM4fSEzQPUzb?= =?us-ascii?Q?oeQH1Rp/3MqJnTRwmblQJqr3EJ9R6LwbZs3moK5KGqxcDRJrA1XFztvs+pap?= =?us-ascii?Q?4ihWmZIX/6yDIt+dzPLF6oqHcHjXBaAgAtSzdS/JPvJKno8c4zaO6Mp9Up3T?= =?us-ascii?Q?HtEhC8j1dEmqtd51YOTw2LC1zftX7Kk4YWANY6450cpSSXz/rBM1IlnQUAcf?= =?us-ascii?Q?GeQc6WcWnd3vpW0koiEOz9G76mrjZ3lt+OwRzZO4+8DjAHPwxNX/nBDviB01?= =?us-ascii?Q?WsZzz38bxsG/vA6d/HdlwAnIhXMnP2fTbLRDNLuNbVC2oYW5YOh4irqQ3pu5?= =?us-ascii?Q?Udb+XH0cwnFInLB29c+i971kl8XB6iYOez6ohOqmOmo66H8De0XqFdeXoUyS?= =?us-ascii?Q?unU3wzT1zkAPd/1li8vxGba2Uib0Fngdg3y7ae2sdlWRQ9Daca2djCBEpUme?= =?us-ascii?Q?nHcP1IZ9Yc/zNqUJhigjayC5NkdHTgDi0pH6a+er+1c6huyhmKfR/XMw9yV5?= =?us-ascii?Q?/8jnJLNQNtLf2KvsyoAVh1KEtLACv4P1fODGNIrcKxj0F9CFvt/ENIVkv0J2?= =?us-ascii?Q?LVyoE+283SfTxJNE2i46XXvw+SpBZATx0WP598CcjkuhCskyMkUPLAQZxIrH?= =?us-ascii?Q?kx6dRjKlmJlrvlk3WhHln+XBNuI/nWmFmFTFjksvsVEWmgKJfEAJSfVsmNyF?= =?us-ascii?Q?DuZM0UQ8fgti0GcpZZQWoR96KhYtRTkISp8jb2XUK6wK6te29nGyqlYAb+rn?= =?us-ascii?Q?rv3HMTw1N/zMeVoBIUWlgwA1LgpAZ4XMEoNhsGWKlVJNxtE/OA1lnixTHnrI?= =?us-ascii?Q?Flo5m70MMgIGRlTozEyhh4MjBm+fcOlebE8xMh6W22De9nnWtWT5fgLQ5Is4?= =?us-ascii?Q?44dhNeI8MW3dsicCw9sYw3VYdq+yiCQ6cpTit7erhleybQKdtDGaJhLvhbhl?= =?us-ascii?Q?JzZzODl0yJfGmCObrZnt3TN5fS9w9VNrmKeHQ++aTR0vtIwWVyySJgK1tVld?= =?us-ascii?Q?HCqWFrVxkiHaj17S85WZ0OYCSiU5qwACesTGGwDSBD55SiaylGFCyyfxFUo2?= =?us-ascii?Q?5+24610QjF5CV1TnbIVcRUMvrvJYpg5SbM8L+VT2zCnWCVt9Q7OrdM9GEqIA?= =?us-ascii?Q?VR/kfOvYLSki3LLbMjwDWFot1Gfm8uQZRM4cNCqNTmUG9bNCBjIQzN5/xxIK?= =?us-ascii?Q?dHk3fw=3D=3D?= X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(35042699022)(376014)(36860700013)(14060799003)(82310400026)(1800799024)(13003099007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2026 17:04:15.3114 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3c7ff2f-f71c-4c7f-f2b9-08de5dc619f4 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: AM4PEPF00025F95.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB11547 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org When enabling the Python limited API, pointers to Python C extension objects can no longer be implicitly converted to 'PyObject *' by the compiler. gdbpy_ref_policy is a templated class that provides a generic interface for incrementing and decrementing the reference counter on the given object. It is used as a specialisation of the policy parameter in gdb::ref_ptr, together with PyObject as the parameter type. As a result, gdbpy_ref_policy always expects an argument derived from PyObject. This patch fixes the resulting compilation issue by adding an explicit static_cast to 'PyObject *' before passing the value to Py_INCREF and Py_DECREF. As a side effect, these casts enforce, at compile time, that the template type passed to gdbpy_ref_policy is a subclass of PyObject. To provide a clearer diagnostic when an incorrect type is used, a static_assert is added to gdbpy_ref_policy, avoiding obscure errors originating from the static_cast. Finally, all C Python extension types passed to gdbpy_ref_policy are updated to inherit from PyObject. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23830 --- gdb/python/py-breakpoint.c | 4 +--- gdb/python/py-cmd.c | 4 +--- gdb/python/py-color.c | 4 +--- gdb/python/py-connection.c | 4 +--- gdb/python/py-corefile.c | 8 ++------ gdb/python/py-disasm.c | 8 ++------ gdb/python/py-events.h | 4 +--- gdb/python/py-frame.c | 4 ++-- gdb/python/py-membuf.c | 5 ++--- gdb/python/py-micmd.c | 4 +--- gdb/python/py-ref.h | 7 +++++-- gdb/python/py-registers.c | 10 ++++------ gdb/python/py-tui.c | 4 +--- gdb/python/python-internal.h | 4 +--- 14 files changed, 25 insertions(+), 49 deletions(-) diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index fc53213966a..3953c441c5c 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -37,10 +37,8 @@ extern PyTypeObject breakpoint_location_object_type; -struct gdbpy_breakpoint_location_object +struct gdbpy_breakpoint_location_object: public PyObject { - PyObject_HEAD - /* An owning reference to the gdb breakpoint location object. */ bp_location *bp_loc; diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 6b40b1796c6..88bc150b765 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -50,10 +50,8 @@ static const struct cmdpy_completer completers[] = /* A gdb command. For the time being only ordinary commands (not set/show commands) are allowed. */ -struct cmdpy_object +struct cmdpy_object: public PyObject { - PyObject_HEAD - /* The corresponding gdb command object, or NULL if the command is no longer installed. */ struct cmd_list_element *command; diff --git a/gdb/python/py-color.c b/gdb/python/py-color.c index b41dff2edd7..e174a7b6858 100644 --- a/gdb/python/py-color.c +++ b/gdb/python/py-color.c @@ -37,10 +37,8 @@ static struct { }; /* A color. */ -struct colorpy_object +struct colorpy_object: public PyObject { - PyObject_HEAD - /* Underlying value. */ ui_file_style::color color; }; diff --git a/gdb/python/py-connection.c b/gdb/python/py-connection.c index bef50b07f18..e42939a995d 100644 --- a/gdb/python/py-connection.c +++ b/gdb/python/py-connection.c @@ -31,10 +31,8 @@ /* The Python object that represents a connection. */ -struct connection_object +struct connection_object: public PyObject { - PyObject_HEAD - /* The process target that represents this connection. When a connection_object is created this field will always point at a valid target. Later, if GDB stops using this target (the target is popped diff --git a/gdb/python/py-corefile.c b/gdb/python/py-corefile.c index 4a6982231c8..622456aaae3 100644 --- a/gdb/python/py-corefile.c +++ b/gdb/python/py-corefile.c @@ -45,10 +45,8 @@ extern PyTypeObject corefile_object_type; /* A gdb.CorefileMapped object. */ -struct corefile_mapped_file_object +struct corefile_mapped_file_object: public PyObject { - PyObject_HEAD - /* The name of a file that was mapped when the core file was created. This is a 'str' object. */ PyObject *filename; @@ -70,10 +68,8 @@ extern PyTypeObject corefile_mapped_file_object_type; /* A gdb.CorefileMappedFileRegion object. */ -struct corefile_mapped_file_region_object +struct corefile_mapped_file_region_object: public PyObject { - PyObject_HEAD - /* The start and end addresses for this mapping, these are addresses within the inferior's address space. */ CORE_ADDR start; diff --git a/gdb/python/py-disasm.c b/gdb/python/py-disasm.c index c1aa4d0586a..037223f05e3 100644 --- a/gdb/python/py-disasm.c +++ b/gdb/python/py-disasm.c @@ -28,10 +28,8 @@ /* Implement gdb.disassembler.DisassembleInfo type. An object of this type represents a single disassembler request from GDB. */ -struct disasm_info_object +struct disasm_info_object: public PyObject { - PyObject_HEAD - /* The architecture in which we are disassembling. */ struct gdbarch *gdbarch; @@ -99,10 +97,8 @@ extern PyTypeObject disasm_part_object_type; the disassembled instruction (in bytes), and the string representing the disassembled instruction. */ -struct disasm_result_object +struct disasm_result_object: public PyObject { - PyObject_HEAD - /* The length of the disassembled instruction in bytes. */ int length; diff --git a/gdb/python/py-events.h b/gdb/python/py-events.h index 9fc7a86920e..a923a923e56 100644 --- a/gdb/python/py-events.h +++ b/gdb/python/py-events.h @@ -27,10 +27,8 @@ /* Stores a list of objects to be notified when the event for which this registry tracks occurs. */ -struct eventregistry_object +struct eventregistry_object: public PyObject { - PyObject_HEAD - PyObject *callbacks; }; diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 027ccb4112d..bb61b058671 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -28,8 +28,8 @@ #include "symfile.h" #include "objfiles.h" -struct frame_object { - PyObject_HEAD +struct frame_object: public PyObject +{ struct frame_id frame_id; struct gdbarch *gdbarch; diff --git a/gdb/python/py-membuf.c b/gdb/python/py-membuf.c index 832ab62cf52..46033a0dda3 100644 --- a/gdb/python/py-membuf.c +++ b/gdb/python/py-membuf.c @@ -19,9 +19,8 @@ #include "python-internal.h" -struct membuf_object { - PyObject_HEAD - +struct membuf_object: public PyObject +{ /* Pointer to the raw data, and array of gdb_bytes. */ void *buffer; diff --git a/gdb/python/py-micmd.c b/gdb/python/py-micmd.c index c6a96dc3ad5..2b4b083d0e3 100644 --- a/gdb/python/py-micmd.c +++ b/gdb/python/py-micmd.c @@ -55,10 +55,8 @@ struct mi_command_py; /* Representation of a Python gdb.MICommand object. */ -struct micmdpy_object +struct micmdpy_object: public PyObject { - PyObject_HEAD - /* The object representing this command in the MI command table. This pointer can be nullptr if the command is not currently installed into the MI command table (see gdb.MICommand.installed property). */ diff --git a/gdb/python/py-ref.h b/gdb/python/py-ref.h index a8f3ff9201b..7594d4a9fc3 100644 --- a/gdb/python/py-ref.h +++ b/gdb/python/py-ref.h @@ -26,14 +26,17 @@ template struct gdbpy_ref_policy { + static_assert(std::is_base_of::value, + "T must be a subclass of PyObject"); + static void incref (T *ptr) { - Py_INCREF (ptr); + Py_INCREF (static_cast (ptr)); } static void decref (T *ptr) { - Py_DECREF (ptr); + Py_DECREF (static_cast (ptr)); } }; diff --git a/gdb/python/py-registers.c b/gdb/python/py-registers.c index ac7480caea9..30b333c444c 100644 --- a/gdb/python/py-registers.c +++ b/gdb/python/py-registers.c @@ -49,9 +49,8 @@ struct register_descriptor_iterator_object { extern PyTypeObject register_descriptor_iterator_object_type; /* A register descriptor. */ -struct register_descriptor_object { - PyObject_HEAD - +struct register_descriptor_object: public PyObject +{ /* The register this is a descriptor for. */ int regnum; @@ -75,9 +74,8 @@ struct reggroup_iterator_object { extern PyTypeObject reggroup_iterator_object_type; /* A register group object. */ -struct reggroup_object { - PyObject_HEAD - +struct reggroup_object: public PyObject +{ /* The register group being described. */ const struct reggroup *reggroup; }; diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c index 578ddfbcc67..be19193770f 100644 --- a/gdb/python/py-tui.c +++ b/gdb/python/py-tui.c @@ -44,10 +44,8 @@ class tui_py_window; /* A PyObject representing a TUI window. */ -struct gdbpy_tui_window +struct gdbpy_tui_window: public PyObject { - PyObject_HEAD - /* The TUI window, or nullptr if the window has been deleted. */ tui_py_window *window; diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index cde2dfa2d52..1b4dcd4c5fe 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -350,10 +350,8 @@ extern PyTypeObject thread_object_type; extern bool gdbpy_breakpoint_init_breakpoint_type (); -struct gdbpy_breakpoint_object +struct gdbpy_breakpoint_object: public PyObject { - PyObject_HEAD - /* The breakpoint number according to gdb. */ int number; -- 2.52.0