Change os.getuid() guard in tmpdir.py
This matches the guard used by typeshed and avoid mypy errors on Windows:
48a346920b/stdlib/os/__init__.pyi (L388)
This commit is contained in:
parent
c85b21eaa0
commit
16685dc279
|
@ -1,6 +1,7 @@
|
||||||
"""Support for providing temporary directories to test functions."""
|
"""Support for providing temporary directories to test functions."""
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
@ -130,9 +131,9 @@ class TempPathFactory:
|
||||||
# Also, to keep things private, fixup any world-readable temp
|
# Also, to keep things private, fixup any world-readable temp
|
||||||
# rootdir's permissions. Historically 0o755 was used, so we can't
|
# rootdir's permissions. Historically 0o755 was used, so we can't
|
||||||
# just error out on this, at least for a while.
|
# just error out on this, at least for a while.
|
||||||
if hasattr(os, "getuid"):
|
if sys.platform != "win32":
|
||||||
rootdir_stat = rootdir.stat()
|
|
||||||
uid = os.getuid()
|
uid = os.getuid()
|
||||||
|
rootdir_stat = rootdir.stat()
|
||||||
# getuid shouldn't fail, but cpython defines such a case.
|
# getuid shouldn't fail, but cpython defines such a case.
|
||||||
# Let's hope for the best.
|
# Let's hope for the best.
|
||||||
if uid != -1:
|
if uid != -1:
|
||||||
|
|
Loading…
Reference in New Issue