forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit37f11c3
committed
This patch addresses the problem mentioned in the "process crash
when a plpython function returns unicode" thread:http://archives.postgresql.org/pgsql-bugs/2005-06/msg00105.phpIn several places PL/Python was calling PyObject_Str() and thenPyString_AsString() without checking if the former had returnedNULL to indicate an error. PyString_AsString() doesn't expect aNULL argument, so passing one causes a segmentation fault. Thispatch adds checks for NULL and raises errors via PLy_elog(), whichprints details of the underlying Python exception. The patch alsoadds regression tests for these checks. All tests pass on mySolaris 9 box running HEAD and Python 2.4.1.In one place the patch doesn't call PLy_elog() because that couldcause infinite recursion; see the comment I added. I'm not surehow to test that particular case or whether it's even possible toget an error there: the value that the code should check is thePython exception type, so I wonder if a NULL value "shouldn'thappen." This patch converts NULL to "Unknown Exception" but Iwonder if an Assert() would be appropriate.The patch is against HEAD but the same changes should be appliedto earlier versions because they have the same problem. The patchmight not apply cleanly against earlier versions -- will the committertake care of little differences or should I submit different versionsof the patch?Michael Fuhr1 parent75a64ee commit37f11c3
File tree
7 files changed
+100
-4
lines changed- src/pl/plpython
- expected
- sql
7 files changed
+100
-4
lines changedLines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + |
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
267 | 267 |
| |
268 | 268 |
| |
269 | 269 |
| |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + |
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
| 44 | + | |
| 45 | + | |
| 46 | + |
Lines changed: 18 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| |||
517 | 517 |
| |
518 | 518 |
| |
519 | 519 |
| |
| 520 | + | |
| 521 | + | |
520 | 522 |
| |
521 | 523 |
| |
522 | 524 |
| |
| |||
774 | 776 |
| |
775 | 777 |
| |
776 | 778 |
| |
| 779 | + | |
| 780 | + | |
777 | 781 |
| |
778 | 782 |
| |
779 | 783 |
| |
| |||
2019 | 2023 |
| |
2020 | 2024 |
| |
2021 | 2025 |
| |
2022 |
| - | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
2023 | 2029 |
| |
2024 | 2030 |
| |
2025 | 2031 |
| |
| |||
2044 | 2050 |
| |
2045 | 2051 |
| |
2046 | 2052 |
| |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
2047 | 2056 |
| |
2048 | 2057 |
| |
2049 | 2058 |
| |
| |||
2531 | 2540 |
| |
2532 | 2541 |
| |
2533 | 2542 |
| |
2534 |
| - | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
2535 | 2550 |
| |
2536 | 2551 |
| |
2537 | 2552 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + |
Lines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
313 | 313 |
| |
314 | 314 |
| |
315 | 315 |
| |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + |
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
42 |
| - | |
| 42 | + | |
| 43 | + | |
| 44 | + |
0 commit comments
Comments
(0)