From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3240 invoked by alias); 4 Dec 2014 18:15:03 -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 3227 invoked by uid 89); 4 Dec 2014 18:15:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 04 Dec 2014 18:15:02 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB4IEvMc024470 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Dec 2014 13:14:58 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB4IEuPh020502; Thu, 4 Dec 2014 13:14:56 -0500 Message-ID: <5480A49F.1010904@redhat.com> Date: Thu, 04 Dec 2014 18:15:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix build with Python 3.4 (PR python/16784) References: <1417009634-2356-1-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1417009634-2356-1-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-12/txt/msg00107.txt.bz2 On 11/26/2014 01:47 PM, Simon Marchi wrote: > The type of the function pointer PyOS_ReadlineFunctionPointer (part of the > Python C API), which we use, slightly changed starting with Python 3.4. The > signature when from "went from" > I changed the signature of deprecated_readline_hook. I would've changed any > user of it, but it seems like nothing is using it, You'd probably find it in the insight/gdbtk code. > --- a/gdb/python/py-gdb-readline.c > +++ b/gdb/python/py-gdb-readline.c > @@ -26,10 +26,13 @@ > cases, sys_stdin and sys_stdout are always stdin and stdout > respectively, as far as I can tell; they are ignored and > command_line_input is used instead. */ > - > static char * Don't lose the empty line. > gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout, > +#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 4 > + const char *prompt) > +#else > char *prompt) > +#endif > > @@ -938,6 +938,8 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix) > strcat (local_prompt, "\n\032\032"); > strcat (local_prompt, annotation_suffix); > strcat (local_prompt, "\n"); > + > + prompt_arg = local_prompt; I think it'd be even clearer if we avoided changing the variable that is called "arg". How about we add: const char *prompt = prompt_arg; at the top, and then use "prompt" throughout, where you're using "prompt_arg"? The 'local_prompt' variable could move to the "annotation_level > 1" block too, for clarity. Thanks, Pedro Alves