Skip to content

Commit 9643718

Browse files
SpaceRacet5w2A6l0IMylesBorins
SpaceRacet5w2A6l0I
authored andcommitted
build: avoid using CMP for BZ2File
Some Python distributions do not support context manager protocol (CMP) for BZ2File. PR-URL: #31198 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Christian Clauss <cclauss@me.com>
1 parent 82b447c commit 9643718

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

configure.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1540,8 +1540,11 @@ def write_config(data, name):
15401540
os.mkdir(icu_tmp_path)
15411541
icu_data_path = os.path.join(icu_tmp_path, icu_data_file_l)
15421542
with open(icu_data_path, 'wb') as outf:
1543-
with bz2.BZ2File(compressed_data, 'rb') as inf:
1544-
shutil.copyfileobj(inf, outf)
1543+
inf = bz2.BZ2File(compressed_data, 'rb')
1544+
try:
1545+
shutil.copyfileobj(inf, outf)
1546+
finally:
1547+
inf.close()
15451548
# Now, proceed..
15461549

15471550
# relative to dep..

0 commit comments

Comments
 (0)