Commit 0dea0ed
committed
PYCBC-1823: Fix pending-exception leak in add_* dict helpers
Changes
--------
* Check the return value of PyDict_SetItem/PyDict_SetItemString in
add_field (all 3 overloads), add_string_field_if_not_empty, and
add_duration_field, reporting a failure via PyErr_WriteUnraisable
instead of leaving the exception pending on the thread
* Apply the same fix to add_bool_field and add_cpp_core_span_field,
changing their return type from void to int to match the rest of
the family
* Add a shared banner comment above the helper block documenting the
return 0/-1 and self-reporting convention for all six functions
Change-Id: I786dd7421d857541a0c9adfee7c7c83797370e05
Reviewed-on: https://review.couchbase.org/c/couchbase-python-client/+/250034
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dimitris Christodoulou <dimitris.christodoulou@couchbase.com>1 parent f373e8f commit 0dea0ed
1 file changed
Lines changed: 35 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
236 | 235 | | |
237 | 236 | | |
238 | 237 | | |
| |||
244 | 243 | | |
245 | 244 | | |
246 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
247 | 249 | | |
248 | 250 | | |
249 | 251 | | |
| |||
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
261 | 266 | | |
262 | 267 | | |
263 | 268 | | |
| |||
271 | 276 | | |
272 | 277 | | |
273 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
274 | 282 | | |
275 | 283 | | |
276 | 284 | | |
277 | | - | |
| 285 | + | |
278 | 286 | | |
279 | 287 | | |
280 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
281 | 293 | | |
282 | 294 | | |
283 | 295 | | |
| |||
293 | 305 | | |
294 | 306 | | |
295 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
296 | 311 | | |
297 | 312 | | |
298 | 313 | | |
| |||
307 | 322 | | |
308 | 323 | | |
309 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
310 | 328 | | |
311 | 329 | | |
312 | 330 | | |
313 | | - | |
| 331 | + | |
314 | 332 | | |
315 | 333 | | |
316 | 334 | | |
317 | 335 | | |
318 | 336 | | |
319 | 337 | | |
320 | | - | |
321 | | - | |
322 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
323 | 346 | | |
| 347 | + | |
324 | 348 | | |
325 | 349 | | |
326 | 350 | | |
| |||
0 commit comments