Repository navigation
Commit 1243cd6
authored
[3.14] pythongh-146452: Improve locking granularity in pickle's batch_dict_… (python#150062)
[3.14] pythongh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (pythonGH-150025)
Remove assertion that could fail in rare race condition.
Replace the coarse critical section wrapping the entire function with
fine-grained sections covering only PyDict_Next + Py_INCREF.
Also handle PyDict_Next returning 0 in the single-item fast path.
(cherry picked from commit 57a0e57)1 parent 8e13025 commit 1243cd6
2 files changed
Lines changed: 31 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3351 | 3351 | | |
3352 | 3352 | | |
3353 | 3353 | | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
3354 | 3357 | | |
3355 | 3358 | | |
3356 | | - | |
| 3359 | + | |
3357 | 3360 | | |
3358 | 3361 | | |
3359 | 3362 | | |
| |||
3370 | 3373 | | |
3371 | 3374 | | |
3372 | 3375 | | |
3373 | | - | |
3374 | | - | |
3375 | | - | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
3376 | 3389 | | |
3377 | 3390 | | |
3378 | 3391 | | |
| |||
3392 | 3405 | | |
3393 | 3406 | | |
3394 | 3407 | | |
3395 | | - | |
3396 | | - | |
3397 | | - | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
| 3419 | + | |
3398 | 3420 | | |
3399 | 3421 | | |
3400 | 3422 | | |
| |||
3424 | 3446 | | |
3425 | 3447 | | |
3426 | 3448 | | |
3427 | | - | |
3428 | | - | |
3429 | | - | |
3430 | | - | |
3431 | | - | |
3432 | | - | |
3433 | | - | |
3434 | | - | |
3435 | | - | |
3436 | | - | |
3437 | | - | |
3438 | | - | |
3439 | 3449 | | |
3440 | 3450 | | |
3441 | 3451 | | |
| |||
0 commit comments