Skip to content

Commit 10a017e

Browse files
ShivangNagtasev-
authored andcommitted
INTEGRITY: Create copy of the game data during lookup map creation to avoid issues due to mutability of python dictionaries.
1 parent 961e678 commit 10a017e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

db_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pymysql.converters import escape_string
99
from collections import defaultdict
1010
import re
11+
import copy
1112

1213
SPECIAL_SYMBOLS = '/":*|\\?%<>\x7f'
1314

@@ -912,7 +913,8 @@ def set_process(
912913
set_to_candidate_dict = defaultdict(list)
913914
id_to_fileset_dict = defaultdict(dict)
914915

915-
game_data_lookup = {fs["name"]: fs for fs in game_data}
916+
# Deep copy to avoid changes in game_data in the loop affecting the lookup map.
917+
game_data_lookup = {fs["name"]: copy.deepcopy(fs) for fs in game_data}
916918

917919
for fileset in game_data:
918920
# Ideally romof should be enough, but adding in case of an edge case

0 commit comments

Comments
 (0)