Skip to content

Commit ca0f88f

Browse files
Fix missing PyErr_NoMemory in getpath.c
1 parent 9e863fa commit ca0f88f

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Avoid possible crash in ``getpath.c`` where a device has no memory left. Now
2+
it properly raises a :exc:`MemoryError`. Patch by Ivy Xu.

Modules/getpath.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ getpath_readlines(PyObject *Py_UNUSED(self), PyObject *args)
368368
if (!buffer) {
369369
Py_DECREF(r);
370370
fclose(fp);
371+
PyErr_NoMemory();
371372
return NULL;
372373
}
373374

0 commit comments

Comments
 (0)