Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc77f218

Browse files
committed
Fix volatile vs. pointer confusion
Variables used after a longjmp() need to be declared volatile. Incase of a pointer, it's the pointer itself that needs to be declaredvolatile, not the pointed-to value. So we need PyObject *volatile items;instead of volatile PyObject *items; /* wrong */Discussion:https://www.postgresql.org/message-id/flat/f747368d-9e1a-c46a-ac76-3c27da32e8e4%402ndquadrant.com
1 parentd4b754c commitc77f218

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎contrib/hstore_plpython/hstore_plpython.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Datum
124124
plpython_to_hstore(PG_FUNCTION_ARGS)
125125
{
126126
PyObject*dict;
127-
volatilePyObject*items_v=NULL;
127+
PyObject*volatileitems=NULL;
128128
int32pcount;
129129
HStore*out;
130130

@@ -135,14 +135,13 @@ plpython_to_hstore(PG_FUNCTION_ARGS)
135135
errmsg("not a Python mapping")));
136136

137137
pcount=PyMapping_Size(dict);
138-
items_v=PyMapping_Items(dict);
138+
items=PyMapping_Items(dict);
139139

140140
PG_TRY();
141141
{
142142
int32buflen;
143143
int32i;
144144
Pairs*pairs;
145-
PyObject*items= (PyObject*)items_v;
146145

147146
pairs=palloc(pcount*sizeof(*pairs));
148147

@@ -173,14 +172,14 @@ plpython_to_hstore(PG_FUNCTION_ARGS)
173172
pairs[i].isnull= false;
174173
}
175174
}
176-
Py_DECREF(items_v);
175+
Py_DECREF(items);
177176

178177
pcount=hstoreUniquePairs(pairs,pcount,&buflen);
179178
out=hstorePairs(pairs,pcount,buflen);
180179
}
181180
PG_CATCH();
182181
{
183-
Py_DECREF(items_v);
182+
Py_DECREF(items);
184183
PG_RE_THROW();
185184
}
186185
PG_END_TRY();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp