Skip to content

Commit b9182d3

Browse files
stestaggsobolevn
andauthored
Code review suggestions
Just set MemoryError and return directly on alloc failure, rather than go via the handler Leave existing error constant as-is for completeness Co-authored-by: sobolevn <mail@sobolevn.me>
1 parent aeb50c0 commit b9182d3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Modules/_interpchannelsmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ clear_module_state(module_state *state)
354354
#define ERR_CHANNEL_INTERP_CLOSED -4
355355
#define ERR_CHANNEL_EMPTY -5
356356
#define ERR_CHANNEL_NOT_EMPTY -6
357-
#define ERR_CHANNEL_MUTEX_ALLOC_FAIL -7
357+
#define ERR_CHANNEL_MUTEX_INIT -7 // currently unused
358358
#define ERR_CHANNELS_MUTEX_INIT -8
359359
#define ERR_NO_NEXT_CHANNEL_ID -9
360360
#define ERR_CHANNEL_CLOSED_WAITING -10
@@ -1743,7 +1743,8 @@ channel_create(_channels *channels, struct _channeldefaults defaults)
17431743
{
17441744
PyThread_type_lock mutex = PyThread_allocate_lock();
17451745
if (mutex == NULL) {
1746-
return ERR_CHANNEL_MUTEX_ALLOC_FAIL;
1746+
PyErr_NoMemory();
1747+
return -1;
17471748
}
17481749
_channel_state *chan = _channel_new(mutex, defaults);
17491750
if (chan == NULL) {

0 commit comments

Comments
 (0)