summaryrefslogtreecommitdiffstats
path: root/Modules/_zoneinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_zoneinfo.c')
-rw-r--r--Modules/_zoneinfo.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c
index c8c791b..0dcdb4d 100644
--- a/Modules/_zoneinfo.c
+++ b/Modules/_zoneinfo.c
@@ -2381,7 +2381,12 @@ get_local_timestamp(PyObject *dt, int64_t *local_ts)
/////
// Functions for cache handling
-/* Constructor for StrongCacheNode */
+/* Constructor for StrongCacheNode
+ *
+ * This function doesn't set MemoryError if PyMem_Malloc fails,
+ * as the cache intentionally doesn't propagate exceptions
+ * and fails silently if error occurs.
+ */
static StrongCacheNode *
strong_cache_node_new(PyObject *key, PyObject *zone)
{
@@ -2572,6 +2577,9 @@ update_strong_cache(zoneinfo_state *state, const PyTypeObject *const type,
}
StrongCacheNode *new_node = strong_cache_node_new(key, zone);
+ if (new_node == NULL) {
+ return;
+ }
StrongCacheNode **root = &(state->ZONEINFO_STRONG_CACHE);
move_strong_cache_node_to_front(state, root, new_node);