Skip to content

Commit

Permalink
Change in-memory database name prefix memdb -> rope-
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lieryan committed Nov 5, 2023
1 parent 9856c02 commit f75467d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rope/contrib/autoimport/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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(
Expand Down

0 comments on commit f75467d

Please sign in to comment.