Commit c25ac11
committed
Fix: gh-152635 _interpchannels channel lock alloc failure
now raises MemoryError
Previously, an allocation failure when creating
the lock for a channel in _interpchannels would trigger an assert.
Caused by `handle_channel_error` being passed an error code of -1
which is only allowed if an exception has been set.
(in this case, no exception was set)
`channelsmod_create` now forwards the error code from `channel_create`
which `handle_channel_error` already handled.
Because the only way to get a -7 error code
(was `ERR_CHANNEL_MUTEX_INIT`) is via an allocation failure in
`PyThread_allocate_lock`, I made `handle_channel_error` raise a
`MemoryError` for this case rather than a `ChannelError`.
I also renamed the constant from `ERR_CHANNEL_MUTEX_INIT` to
`ERR_CHANNEL_ALLOC_LOCK` to make this clearer for future changes.1 parent 5717518 commit c25ac11
3 files changed
Lines changed: 24 additions & 6 deletions
File tree
- Lib/test/test_interpreters
- Misc/NEWS.d/next/Core_and_Builtins
- Modules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
431 | | - | |
432 | | - | |
| 430 | + | |
| 431 | + | |
433 | 432 | | |
434 | 433 | | |
435 | 434 | | |
| |||
1744 | 1743 | | |
1745 | 1744 | | |
1746 | 1745 | | |
1747 | | - | |
| 1746 | + | |
1748 | 1747 | | |
1749 | 1748 | | |
1750 | 1749 | | |
| |||
2938 | 2937 | | |
2939 | 2938 | | |
2940 | 2939 | | |
2941 | | - | |
| 2940 | + | |
2942 | 2941 | | |
2943 | 2942 | | |
2944 | 2943 | | |
| |||
0 commit comments