Skip to content

Commit 65eebcf

Browse files
committed
gh-151126: Add PyErr_NoMemory() in strong_cache_node_new
1 parent 3186547 commit 65eebcf

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
Fix a crash, when there's no memory left on a device,
2-
which happened in code compilation.
3-
Now it raises a proper :exc:`MemoryError`.
2+
which happened in:
3+
- Code compilation
4+
- :mod:`zoneinfo` caching
5+
6+
Now these places raise a proper :exc:`MemoryError`.

Modules/_zoneinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,6 +2353,7 @@ strong_cache_node_new(PyObject *key, PyObject *zone)
23532353
{
23542354
StrongCacheNode *node = PyMem_Malloc(sizeof(StrongCacheNode));
23552355
if (node == NULL) {
2356+
PyErr_NoMemory();
23562357
return NULL;
23572358
}
23582359

0 commit comments

Comments
 (0)