This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix build with Python 3.4 (PR python/16784)

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,
> +			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.

Pedro Alves

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]