Skip to content

Commit c7f5c58

Browse files
committed
PL/Python: Fix remaining scan-build warnings
Apparently, scan-build thinks that proc->is_setof can change during PLy_exec_function(). To make it clearer, save the value in a local variable. Also add an assertion to clear another warning. Reviewed-by: John Naylor <jcnaylor@gmail.com>
1 parent cdddd5d commit c7f5c58

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pl/plpython/plpy_exec.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static void PLy_abort_open_subtransactions(int save_subxact_level);
5757
Datum
5858
PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc)
5959
{
60+
bool is_setof = proc->is_setof;
6061
Datum rv;
6162
PyObject *volatile plargs = NULL;
6263
PyObject *volatile plrv = NULL;
@@ -73,7 +74,7 @@ PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc)
7374

7475
PG_TRY();
7576
{
76-
if (proc->is_setof)
77+
if (is_setof)
7778
{
7879
/* First Call setup */
7980
if (SRF_IS_FIRSTCALL())
@@ -93,6 +94,7 @@ PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc)
9394
funcctx = SRF_PERCALL_SETUP();
9495
Assert(funcctx != NULL);
9596
srfstate = (PLySRFState *) funcctx->user_fctx;
97+
Assert(srfstate != NULL);
9698
}
9799

98100
if (srfstate == NULL || srfstate->iter == NULL)
@@ -125,7 +127,7 @@ PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc)
125127
* We stay in the SPI context while doing this, because PyIter_Next()
126128
* calls back into Python code which might contain SPI calls.
127129
*/
128-
if (proc->is_setof)
130+
if (is_setof)
129131
{
130132
if (srfstate->iter == NULL)
131133
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy