Commit ce170411 authored by bashi@chromium.org's avatar bashi@chromium.org

IDL: Overwrite pickle file when an exception occurs

It seems that TypeErrors can be thrown when we modify the content of
pickle files (e.g. InterfacesInfoCoreIndividual.pickle). We can
just overwrite pickle files if pickle.load() throws an exception.

Review URL: https://codereview.chromium.org/643153006

git-svn-id: svn://svn.chromium.org/blink/trunk@184334 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 08cb4ee0
...@@ -116,7 +116,7 @@ def write_pickle_file(pickle_filename, data, only_if_changed): ...@@ -116,7 +116,7 @@ def write_pickle_file(pickle_filename, data, only_if_changed):
try: try:
if pickle.load(pickle_file) == data: if pickle.load(pickle_file) == data:
return return
except (EOFError, pickle.UnpicklingError): except Exception:
# If trouble unpickling, overwrite # If trouble unpickling, overwrite
pass pass
with open(pickle_filename, 'w') as pickle_file: with open(pickle_filename, 'w') as pickle_file:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment