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 v2 2/8] Python: Fix exception handling in py-record-btrace.c


On 04/21/2017 11:49 AM, Tim Wiederhake wrote:
> GDB_PY_HANDLE_EXCEPTION does not handle all exceptions.  Replace with call to
> gdbpy_convert_exception.

This makes no sense to me.  Here's the definition:

/* Use this after a TRY_EXCEPT to throw the appropriate Python
   exception.  */
#define GDB_PY_HANDLE_EXCEPTION(Exception)	\
  do {						\
    if (Exception.reason < 0)			\
      {						\
	gdbpy_convert_exception (Exception);	\
        return NULL;				\
      }						\
  } while (0)

That definitely handles all exceptions.  "reason" is never
positive.

I could see

> @@ -891,14 +898,17 @@ recpy_bt_goto (PyObject *self, PyObject *args)
>  	target_goto_record_end ();
>        else
>  	target_goto_record (obj->number);
> +
> +      Py_INCREF (Py_None);
> +      ret = Py_None;
>      }
>    CATCH (except, RETURN_MASK_ALL)
>      {
> -      GDB_PY_HANDLE_EXCEPTION (except);
> +      gdbpy_convert_exception (except);
>      }
>    END_CATCH
>
> -  Py_RETURN_NONE;
> +  return ret;
>  }

this particular change making sense, but for a completely
different reason -- GDB_PY_HANDLE_EXCEPTION returns NULL
and here you seem to want to return a Py_None with a
reference.  But that should be split to its own patch
with its own rationale.

Thanks,
Pedro Alves


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