From f75467d679b72770f4574b21329e232dadc5ba4c Mon Sep 17 00:00:00 2001 From: Lie Ryan Date: Mon, 6 Nov 2023 01:53:34 +1100 Subject: [PATCH] Change in-memory database name prefix `memdb` -> `rope-` This better clearly uniquely identify the database. While the likelihood of a problem in practice should be really, really small, in theory because rope is a library, it may share its memory space with other libraries, which may have used the same naming scheme. --- rope/contrib/autoimport/sqlite.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rope/contrib/autoimport/sqlite.py b/rope/contrib/autoimport/sqlite.py index 5791ea977..f02d426ba 100644 --- a/rope/contrib/autoimport/sqlite.py +++ b/rope/contrib/autoimport/sqlite.py @@ -155,6 +155,7 @@ def create_database_connection( memory : bool if true, don't persist to disk """ + def calculate_project_hash(data: str) -> str: return sha256(data.encode()).hexdigest() @@ -171,7 +172,7 @@ def calculate_project_hash(data: str) -> str: else: project_hash = calculate_project_hash(project.ropefolder.real_path) return sqlite3.connect( - f"file:memdb{project_hash}:?mode=memory&cache=shared", uri=True + f"file:rope-{project_hash}:?mode=memory&cache=shared", uri=True ) else: return sqlite3.connect(