diff options
author | Alex Waygood <Alex.Waygood@Gmail.com> | 2023-12-01 14:54:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-01 14:54:33 (GMT) |
commit | 70a38ffb3d712f973eb17bd1bda541f238ae70d2 (patch) | |
tree | 5908df71f04c2a8a4e59a83135c05d2578923c5f /Lib/test/libregrtest/utils.py | |
parent | 5f6ac2d88a49b8a7c764691365cd41ee6226a8d0 (diff) | |
download | cpython-70a38ffb3d712f973eb17bd1bda541f238ae70d2.zip cpython-70a38ffb3d712f973eb17bd1bda541f238ae70d2.tar.gz cpython-70a38ffb3d712f973eb17bd1bda541f238ae70d2.tar.bz2 |
gh-109413: libregrtest: enable mypy's `--strict-optional` check on most files (#112586)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/test/libregrtest/utils.py')
-rw-r--r-- | Lib/test/libregrtest/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index d47e938..d4972ce 100644 --- a/Lib/test/libregrtest/utils.py +++ b/Lib/test/libregrtest/utils.py @@ -377,10 +377,19 @@ def get_temp_dir(tmp_dir: StrPath | None = None) -> StrPath: # Python out of the source tree, especially when the # source tree is read only. tmp_dir = sysconfig.get_config_var('srcdir') + if not tmp_dir: + raise RuntimeError( + "Could not determine the correct value for tmp_dir" + ) tmp_dir = os.path.join(tmp_dir, 'build') else: # WASI platform tmp_dir = sysconfig.get_config_var('projectbase') + if not tmp_dir: + raise RuntimeError( + "sysconfig.get_config_var('projectbase') " + f"unexpectedly returned {tmp_dir!r} on WASI" + ) tmp_dir = os.path.join(tmp_dir, 'build') # When get_temp_dir() is called in a worker process, |