File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -62,3 +62,7 @@ property. This now raises a TypeError.
6262`.FileMovieWriter ` now defaults to writing temporary frames in a temporary
6363directory, which is always cleared at exit. In order to keep the individual
6464frames saved on the filesystem, pass an explicit *frame_prefix *.
65+
66+ `.font_manager.json_dump ` now locks the font manager dump file
67+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68+ ... to prevent multiple processes from writing to it at the same time.
Original file line number Diff line number Diff line change @@ -914,11 +914,14 @@ def json_dump(data, filename):
914914 shipped with Matplotlib) are stored relative to that data path (to remain
915915 valid across virtualenvs).
916916
917+ This function temporarily locks the output file to prevent multiple
918+ processes from overwriting one another's output.
919+
917920 See Also
918921 --------
919922 json_load
920923 """
921- with open (filename , 'w' ) as fh :
924+ with cbook . _lock_path ( filename ), open (filename , 'w' ) as fh :
922925 try :
923926 json .dump (data , fh , cls = _JSONEncoder , indent = 2 )
924927 except OSError as e :
@@ -1335,8 +1338,7 @@ def get_font(filename, hinting_factor=None):
13351338def _rebuild ():
13361339 global fontManager
13371340 fontManager = FontManager ()
1338- with cbook ._lock_path (_fmcache ):
1339- json_dump (fontManager , _fmcache )
1341+ json_dump (fontManager , _fmcache )
13401342 _log .info ("generated new fontManager" )
13411343
13421344
You can’t perform that action at this time.
0 commit comments