Move return statements out of PG_TRY blocks.
authorNathan Bossart <nathan@postgresql.org>
Wed, 3 May 2023 18:32:43 +0000 (11:32 -0700)
committerNathan Bossart <nathan@postgresql.org>
Thu, 4 May 2023 23:25:05 +0000 (16:25 -0700)
commit52c9cf3239b85f272d928db178d44947c9173d76
tree4ae9e9bc4f9f6c25b77942e872502caff19c16ba
parentd5de344a50d3fa03fad38fe41cc3443db4143bb5
Move return statements out of PG_TRY blocks.

If we exit a PG_TRY block early via "continue", "break", "goto", or
"return", we'll skip unwinding its exception stack.  This change
moves a couple of such "return" statements in PL/Python out of
PG_TRY blocks.  This was introduced in d0aa965c0a and affects all
supported versions.

We might also be able to add compile-time checks to prevent
recurrence, but that is left as a future exercise.

Reported-by: Mikhail Gribkov, Xing Guo
Author: Xing Guo
Reviewed-by: Michael Paquier, Andres Freund, Tom Lane
Discussion: https://postgr.es/m/CAMEv5_v5Y%2B-D%3DCO1%2Bqoe16sAmgC4sbbQjz%2BUtcHmB6zcgS%2B5Ew%40mail.gmail.com
Discussion: https://postgr.es/m/CACpMh%2BCMsGMRKFzFMm3bYTzQmMU5nfEEoEDU2apJcc4hid36AQ%40mail.gmail.com
Backpatch-through: 11 (all supported versions)
src/pl/plpython/plpy_exec.c