This is an automated email from the ASF dual-hosted git repository.
mshr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new ff883dbcbc Revert "fix: add safety warning to pickle_memoize cache
loading" (#18926)
ff883dbcbc is described below
commit ff883dbcbc7e52db32d1d320e796477082c72197
Author: Tianqi Chen <[email protected]>
AuthorDate: Tue Mar 24 11:17:29 2026 -0400
Revert "fix: add safety warning to pickle_memoize cache loading" (#18926)
Reverts apache/tvm#18925
---
python/tvm/contrib/pickle_memoize.py | 8 -------
.../python/contrib/test_pickle_memoize_warning.py | 26 ----------------------
2 files changed, 34 deletions(-)
diff --git a/python/tvm/contrib/pickle_memoize.py
b/python/tvm/contrib/pickle_memoize.py
index 64a88068ec..f9981a5ea4 100644
--- a/python/tvm/contrib/pickle_memoize.py
+++ b/python/tvm/contrib/pickle_memoize.py
@@ -23,7 +23,6 @@ import functools
import os
import pathlib
import sys
-import warnings
try:
import cPickle as pickle
@@ -72,13 +71,6 @@ class Cache:
if self.path.exists():
with self.path.open("rb") as cache_file:
try:
- warnings.warn(
- f"Loading cached pickle file from {self.path}. "
- "Pickle files can execute arbitrary code. "
- "Only load cache files you trust.",
- UserWarning,
- stacklevel=2,
- )
cache = pickle.load(cache_file)
except pickle.UnpicklingError:
cache = {}
diff --git a/tests/python/contrib/test_pickle_memoize_warning.py
b/tests/python/contrib/test_pickle_memoize_warning.py
deleted file mode 100644
index 3f26961d20..0000000000
--- a/tests/python/contrib/test_pickle_memoize_warning.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import pytest
-import pickle
-import tempfile
-import os
-
-
-def test_pickle_memoize_warns_on_cache_load():
- """Test that loading a cached pickle file emits a UserWarning."""
- from tvm.contrib.pickle_memoize import memoize
-
- # Create a cache file
- with tempfile.TemporaryDirectory() as tmpdir:
- cache_path = os.path.join(tmpdir, "test_cache")
-
- @memoize("test_warning_cache")
- def dummy_func():
- return 42
-
- # First call creates cache
- result = dummy_func()
- assert result == 42
-
- # Second call loads from cache — should warn
- with pytest.warns(UserWarning, match="Pickle files can execute
arbitrary code"):
- result2 = dummy_func()
- assert result2 == 42