From 5fa11a12dffde77f9f4507857c380bb13eda953e Mon Sep 17 00:00:00 2001 From: Gowthami B Date: Thu, 2 Oct 2025 15:11:07 -0400 Subject: [PATCH] Add lock for `cachetools` (#2555) # Rationale for this change Fixes #1905 ## Are these changes tested? ## Are there any user-facing changes? --- pyiceberg/manifest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyiceberg/manifest.py b/pyiceberg/manifest.py index 61cb87e3d8..a532da908c 100644 --- a/pyiceberg/manifest.py +++ b/pyiceberg/manifest.py @@ -17,6 +17,7 @@ from __future__ import annotations import math +import threading from abc import ABC, abstractmethod from copy import copy from enum import Enum @@ -718,7 +719,7 @@ def fetch_manifest_entry(self, io: FileIO, discard_deleted: bool = True) -> List ] -@cached(cache=LRUCache(maxsize=128), key=lambda io, manifest_list: hashkey(manifest_list)) +@cached(cache=LRUCache(maxsize=128), key=lambda io, manifest_list: hashkey(manifest_list), lock=threading.RLock()) def _manifests(io: FileIO, manifest_list: str) -> Tuple[ManifestFile, ...]: """Read and cache manifests from the given manifest list, returning a tuple to prevent modification.""" file = io.new_input(manifest_list)