Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid overwriting dicts.dat if it is unchanged #1647

Merged
merged 1 commit into from
Jan 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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