FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.14] gh-151126: Add missing `PyErr_NoMemory` in `_winapi.c` (GH-151588) by miss-islington · Pull Request #152183 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Avoid possible crash in ``_winapi.c`` where a device has no memory left. Now
it properly raises a :exc:`MemoryError`. Patch by Ivy Xu.
4 changes: 4 additions & 0 deletions Modules/_winapi.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,9 @@ _winapi_GetShortPathName_impl(PyObject *module, LPCWSTR path)
}
PyMem_Free((void *)buffer);
}
else {
PyErr_NoMemory();
}
} else {
PyErr_SetFromWindowsErr(0);
}
Expand Down Expand Up @@ -2374,6 +2377,7 @@ _winapi_BatchedWaitForMultipleObjects_impl(PyObject *module,
while (i < nhandles) {
BatchedWaitData *data = (BatchedWaitData*)PyMem_Malloc(sizeof(BatchedWaitData));
if (!data) {
PyErr_NoMemory();
goto error;
}
thread_data[thread_count++] = data;
Expand Down
Loading

Back | FazBrowse Home | New Git URL