This is the mail archive of the gdb-patches@sourceware.org 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 Python completion when using the "complete" command


Sergio Durigan Junior writes:
 > On Wednesday, April 08 2015, Keith Seitz wrote:
 > 
 > >>> >+   This function is usually called twice: one when we are figuring out
 > >
 > > nitpick (sorry): "once" instead of "one"
 > 
 > Thanks, fixed.
 > 
 > > This looks good to me.
 > >
 > > I have applied this patch to my completer branch, and I can verify
 > > that it fixes the (other) completion problems I've seen. I recommend
 > > that a maintainer approve this.
 > 
 > Thanks for the review, Keith!
 > 
 > Here is the updated patch + ChangeLog entry.
 > 
 > -- 
 > Sergio
 > GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
 > Please send encrypted e-mail if possible
 > http://sergiodj.net/
 > 
 > gdb/ChangeLog:
 > 2015-04-08  Sergio Durigan Junior  <sergiodj@redhat.com>
 > 
 > 	PR python/16699
 > 	* python/py-cmd.c (cmdpy_completer_helper): Adjust function to not
 > 	use a caching mechanism.  Adjust comments and code to reflect
 > 	that.  Replace 'sizeof' by 'strlen' when fetching 'wordobj'.
 > 	(cmdpy_completer_handle_brkchars): Adjust call to
 > 	cmdpy_completer_helper.  Call Py_XDECREF for 'resultobj'.
 > 	(cmdpy_completer): Likewise.
 > 
 > gdb/testsuite/ChangeLog:
 > 2015-04-08  Keith Seitz  <keiths@redhat.com>
 > 
 > 	PR python/16699
 > 	* gdb.python/py-completion.exp: New tests for completion.
 > 	* gdb.python/py-completion.py (CompleteLimit1): New class.
 > 	(CompleteLimit2): Likewise.
 > 	(CompleteLimit3): Likewise.
 > 	(CompleteLimit4): Likewise.
 > 	(CompleteLimit5): Likewise.
 > 	(CompleteLimit6): Likewise.
 > 	(CompleteLimit7): Likewise.

LGTM.

One comment below.

 > +  resultobj = PyObject_CallMethodObjArgs ((PyObject *) obj, complete_cst,
 > +					  textobj, wordobj, NULL);
 > +  Py_DECREF (textobj);
 > +  Py_DECREF (wordobj);
 > +  if (!resultobj)
 > +    {
 > +      /* Just swallow errors here.  */
 > +      PyErr_Clear ();
 >      }

I realize this is just copying the previous code,
but does swallowing errors here make it hard to debug problems
in the completer function?
Is this something we want to address in a future patch?


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