Skip to content

Commit 07e3688

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

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
@@ -673,12 +673,13 @@ read_console_w(HANDLE handle, DWORD maxlen, DWORD *readlen) {
673673
maxlen += 1;
674674
Py_BLOCK_THREADS
675675
newbuf = (wchar_t*)PyMem_Realloc(buf, maxlen * sizeof(wchar_t));
676-
Py_UNBLOCK_THREADS
677676
if (!newbuf) {
678677
sig = -1;
679678
PyErr_NoMemory();
679+
Py_UNBLOCK_THREADS
680680
break;
681681
}
682+
Py_UNBLOCK_THREADS
682683
buf = newbuf;
683684
/* Only advance by n and not BUFSIZ in this case */
684685
off += n;

0 commit comments

Comments
 (0)