From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61354 invoked by alias); 15 Jun 2018 21:27:39 -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 61340 invoked by uid 89); 15 Jun 2018 21:27:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: sesbmg23.ericsson.net Received: from sesbmg23.ericsson.net (HELO sesbmg23.ericsson.net) (193.180.251.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Jun 2018 21:27:37 +0000 Received: from ESESSHC013.ericsson.se (Unknown_Domain [153.88.183.57]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id 11.3E.31551.64F242B5; Fri, 15 Jun 2018 23:27:34 +0200 (CEST) Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESSHC013.ericsson.se (153.88.183.57) with Microsoft SMTP Server (TLS) id 14.3.382.0; Fri, 15 Jun 2018 23:27:34 +0200 Received: from ESESBMB504.ericsson.se (153.88.183.171) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 15 Jun 2018 23:27:34 +0200 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB504.ericsson.se (153.88.183.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Fri, 15 Jun 2018 23:27:33 +0200 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from elxacz23q12.ca.am.ericsson.se (192.75.88.130) by DM6PR15MB2394.namprd15.prod.outlook.com (2603:10b6:5:8d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Fri, 15 Jun 2018 21:27:32 +0000 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH 2/3] gdb-gdb.py.in: Fix ordering of TypeFlags objects with Python 3 Date: Fri, 15 Jun 2018 21:27:00 -0000 Message-ID: <1529098041-2212-2-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1529098041-2212-1-git-send-email-simon.marchi@ericsson.com> References: <1529098041-2212-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: SN6PR08CA0019.namprd08.prod.outlook.com (2603:10b6:805:66::32) To DM6PR15MB2394.namprd15.prod.outlook.com (2603:10b6:5:8d::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9965c208-eabd-476c-d7be-08d5d306ce60 X-MS-TrafficTypeDiagnostic: DM6PR15MB2394: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-MS-Exchange-SenderADCheck: 1 X-Forefront-PRVS: 0704670F76 Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2018 21:27:32.4528 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9965c208-eabd-476c-d7be-08d5d306ce60 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR15MB2394 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00411.txt.bz2 Python 3 doesn't use __cmp__ to order objects, it uses __lt__. Because of this, we get this exception when trying to pretty-print "type" objects: I tested it with Python 2.7 as well. gdb/ChangeLog: * gdb-gdb.py.in (TypeFlag) <__cmp__>: Remove. <__lt__>: Add. --- gdb/gdb-gdb.py.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/gdb-gdb.py.in b/gdb/gdb-gdb.py.in index b8bb1ad..c844e4c 100644 --- a/gdb/gdb-gdb.py.in +++ b/gdb/gdb-gdb.py.in @@ -38,9 +38,11 @@ class TypeFlag: self.name = name self.value = value self.short_name = name.replace("TYPE_INSTANCE_FLAG_", '') - def __cmp__(self, other): + + def __lt__(self, other): """Sort by value order.""" - return self.value.__cmp__(other.value) + return self.value < other.value + # A list of all existing TYPE_INSTANCE_FLAGS_* enumerations, # stored as TypeFlags objects. Lazy-initialized. -- 2.7.4