Skip to content

Commit

Permalink
build: avoid using CMP for BZ2File
Browse files Browse the repository at this point in the history
Some Python distributions do not support
context manager protocol (CMP) for BZ2File.

PR-URL: #31198
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Christian Clauss <[email protected]>
  • Loading branch information
SpaceRacet5w2A6l0I authored and MylesBorins committed Jan 16, 2020
1 parent 82b447c commit 9643718
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1540,8 +1540,11 @@ def write_config(data, name):
os.mkdir(icu_tmp_path)
icu_data_path = os.path.join(icu_tmp_path, icu_data_file_l)
with open(icu_data_path, 'wb') as outf:
with bz2.BZ2File(compressed_data, 'rb') as inf:
shutil.copyfileobj(inf, outf)
inf = bz2.BZ2File(compressed_data, 'rb')
try:
shutil.copyfileobj(inf, outf)
finally:
inf.close()
# Now, proceed..

# relative to dep..
Expand Down

0 comments on commit 9643718

Please sign in to comment.