PL/Python: Fix crash in functions returning SETOF and using SPI
Peter Eisentraut <peter_e@gmx.net>
PL/Python: Fix crash in functions returning SETOF and using SPI Allocate PLyResultObject.tupdesc in TopMemoryContext, because its lifetime is the lifetime of the Python object and it shouldn't be freed by some other memory context, such as one controlled by SPI. We trust that the Python object will clean up its own memory. Before, this would crash the included regression test case by trying to use memory that was already freed. reported by Asif Naeem, analysis by Tom Lane
Files
| Path | Change | +/− |
|---|---|---|
| src/pl/plpython/expected/plpython_setof.out | modified | +16 −0 |
| src/pl/plpython/plpy_spi.c | modified | +11 −0 |
| src/pl/plpython/sql/plpython_setof.sql | modified | +12 −0 |