Escape table name in diskcache queries. (#3543)

Some devices create cache table names with non-alphanumerical characters, e.g. "compile_hip_gfx1010:xnack-_12".
This commit escapes the table name in single quotes s.t. sqlite works (see https://github.com/tinygrad/tinygrad/issues/3538).
This commit is contained in:
Marcin Słowik
2024-02-29 22:04:21 +01:00
committed by GitHub
parent 0afde98ba5
commit f90caa4b92
2 changed files with 8 additions and 3 deletions

View File

@@ -76,5 +76,10 @@ class DiskCache(unittest.TestCase):
self.assertEqual(diskcache_get(table, fancy_key), 5)
self.assertEqual(diskcache_get(table, fancy_key3), None)
def test_table_name(self):
table = "test_gfx1010:xnack-"
diskcache_put(table, "key", "test")
self.assertEqual(diskcache_get(table, "key"), "test")
if __name__ == "__main__":
unittest.main()