Re: [PATCH 3/4] Change thread_to_thread_object to return a new reference

Tom Tromey
2018-09-17T05:31:22Z

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> On 2018-09-16 10:05, Tom Tromey wrote:
>> I re-read all of this and I think thread_to_thread_object has a latent
>> bug. It can return NULL early due to an error:
>>
>> gdbpy_ref<inferior_object> inf_obj (inferior_to_inferior_object
>> (thr->inf));
>> if (inf_obj == NULL)
>> return NULL;
>>
>> or it can return NULL at the end meaning "thread not found".

Simon> I am not sure how these two mode of failure differ. Don't we expect
Simon> the passed thread_info object to always be valid, and therefore both
Simon> cases returning NULL would be an internal GDB logic error?

I just meant that the difference here is whether or not the Python
exception is set -- that this function isn't following the normal,
simple convention here, but that I think it should.

Tom