Skip to content

Commit 23fcb48

Browse files
miss-islingtonaisk
andauthored
[3.13] gh-149983: Fix PyErr_NoMemory call without GIL in winconsoleio.c (GH-149984) (GH-150112)
(cherry picked from commit 3d2aa89) Co-authored-by: AN Long <aisk@users.noreply.github.com>
1 parent 6fb207e commit 23fcb48

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Modules/_io/winconsoleio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,13 @@ read_console_w(HANDLE handle, DWORD maxlen, DWORD *readlen) {
669669
maxlen += 1;
670670
Py_BLOCK_THREADS
671671
newbuf = (wchar_t*)PyMem_Realloc(buf, maxlen * sizeof(wchar_t));
672-
Py_UNBLOCK_THREADS
673672
if (!newbuf) {
674673
sig = -1;
675674
PyErr_NoMemory();
675+
Py_UNBLOCK_THREADS
676676
break;
677677
}
678+
Py_UNBLOCK_THREADS
678679
buf = newbuf;
679680
/* Only advance by n and not BUFSIZ in this case */
680681
off += n;

0 commit comments

Comments
 (0)