Skip to content

Commit

Permalink
Avoid overwriting dicts.dat if it is unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
SReicheltPTV authored and mhammond committed Jan 12, 2021
1 parent 09c57bf commit fc102c6
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions com/win32com/client/gencache.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,27 +546,25 @@ def AddModuleToCache(typelibclsid, lcid, major, minor, verbose = 1, bFlushNow =
# if mod._in_gencache_ is already true, then we are reloading this
# module - this doesn't mean anything special though!
mod._in_gencache_ = 1
dict = mod.CLSIDToClassMap
info = str(typelibclsid), lcid, major, minor
for clsid, cls in dict.items():
clsidToTypelib[clsid] = info
dict_modified = False

dict = mod.CLSIDToPackageMap
for clsid, name in dict.items():
clsidToTypelib[clsid] = info
def SetTypelibForAllClsids(dict):
nonlocal dict_modified
for clsid, cls in dict.items():
if clsidToTypelib.get(clsid) != info:
clsidToTypelib[clsid] = info
dict_modified = True

dict = mod.VTablesToClassMap
for clsid, cls in dict.items():
clsidToTypelib[clsid] = info

dict = mod.VTablesToPackageMap
for clsid, cls in dict.items():
clsidToTypelib[clsid] = info
SetTypelibForAllClsids(mod.CLSIDToClassMap)
SetTypelibForAllClsids(mod.CLSIDToPackageMap)
SetTypelibForAllClsids(mod.VTablesToClassMap)
SetTypelibForAllClsids(mod.VTablesToPackageMap)

# If this lib was previously redirected, drop it
if info in versionRedirectMap:
del versionRedirectMap[info]
if bFlushNow:
if bFlushNow and dict_modified:
_SaveDicts()

def GetGeneratedInfos():
Expand Down

0 comments on commit fc102c6

Please sign in to comment.