diff options
author | Christian Heimes <christian@python.org> | 2022-06-19 18:18:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-19 18:18:34 (GMT) |
commit | 10731849184a3101ed18683b0128d689f1671c3f (patch) | |
tree | 81b16b717d80c67689abb115d0fe7412952a93bc /Lib/test/libregrtest | |
parent | 15c8838273e1be94dc3f32db21a35f5302ed1a1d (diff) | |
download | cpython-10731849184a3101ed18683b0128d689f1671c3f.zip cpython-10731849184a3101ed18683b0128d689f1671c3f.tar.gz cpython-10731849184a3101ed18683b0128d689f1671c3f.tar.bz2 |
[3.11] gh-84461: Fix Emscripten umask and permission issues (GH-94002) (GH-94006)
Co-authored-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Lib/test/libregrtest')
-rw-r--r-- | Lib/test/libregrtest/main.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index 85bf6e1..cc8ba05 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -600,6 +600,16 @@ class Regrtest: for s in ET.tostringlist(root): f.write(s) + def fix_umask(self): + if support.is_emscripten: + # Emscripten has default umask 0o777, which breaks some tests. + # see https://github.com/emscripten-core/emscripten/issues/17269 + old_mask = os.umask(0) + if old_mask == 0o777: + os.umask(0o027) + else: + os.umask(old_mask) + def set_temp_dir(self): if self.ns.tempdir: self.tmp_dir = self.ns.tempdir @@ -660,6 +670,8 @@ class Regrtest: self.set_temp_dir() + self.fix_umask() + if self.ns.cleanup: self.cleanup() sys.exit(0) |