Re: [HACKERS] Fix for segfault in plpython's exception handling

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Fix for segfault in plpython's exception handling
Дата
Msg-id 17995.1481299107@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [HACKERS] Fix for segfault in plpython's exception handling  (Rafa de la Torre <rtorre@carto.com>)
Ответы Re: [HACKERS] Fix for segfault in plpython's exception handling  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Rafa de la Torre <rtorre@carto.com> writes:
>          exc = PyErr_NewException(exception_map[i].name, base, dict);
> +        Py_INCREF(exc);
>          PyModule_AddObject(mod, exception_map[i].classname, exc);

Hm.  Seems like if this is a problem, the code for the other three
exceptions is being a bit careless: it does do Py_INCREFs on them,
but not soon enough to ensure no problems.  Also, I wonder why that
code checks for a null result from PyErr_NewException but this doesn't.

Good catch though.  A naive person would have assumed that
PyModule_AddObject would increment the object's refcount, but
the Python docs say "This steals a reference to value", which
I guess must mean that the caller is required to do it.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: [HACKERS] jsonb problematic operators
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] Logical Replication WIP