From f06f2e97bb57e06d6a790f8a1dcf305d055bfc8c Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Fri, 12 Apr 2019 23:00:19 -0700 Subject: [PATCH] Make os.altsep Optional on non-win32 platforms (#2918) Keep it str on win32 to avoid breaking win32-specific code that relies on it. --- stdlib/2/os/__init__.pyi | 5 ++++- stdlib/2/os/path.pyi | 5 ++++- stdlib/2/os2emxpath.pyi | 5 ++++- stdlib/2and3/macpath.pyi | 5 ++++- stdlib/2and3/ntpath.pyi | 5 ++++- stdlib/2and3/posixpath.pyi | 5 ++++- stdlib/3/os/__init__.pyi | 5 ++++- stdlib/3/os/path.pyi | 5 ++++- 8 files changed, 32 insertions(+), 8 deletions(-) diff --git a/stdlib/2/os/__init__.pyi b/stdlib/2/os/__init__.pyi index 4a8489347..2c66dc79d 100644 --- a/stdlib/2/os/__init__.pyi +++ b/stdlib/2/os/__init__.pyi @@ -63,7 +63,10 @@ O_LARGEFILE: int # Gnu extension if in C library curdir: str pardir: str sep: str -altsep: str +if sys.platform == 'win32': + altsep: str +else: + altsep: Optional[str] extsep: str pathsep: str defpath: str diff --git a/stdlib/2/os/path.pyi b/stdlib/2/os/path.pyi index 09663afa4..c0bf57658 100644 --- a/stdlib/2/os/path.pyi +++ b/stdlib/2/os/path.pyi @@ -27,7 +27,10 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -altsep: str +if sys.platform == 'win32': + altsep: str +else: + altsep: Optional[str] extsep: str pathsep: str defpath: str diff --git a/stdlib/2/os2emxpath.pyi b/stdlib/2/os2emxpath.pyi index 09663afa4..c0bf57658 100644 --- a/stdlib/2/os2emxpath.pyi +++ b/stdlib/2/os2emxpath.pyi @@ -27,7 +27,10 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -altsep: str +if sys.platform == 'win32': + altsep: str +else: + altsep: Optional[str] extsep: str pathsep: str defpath: str diff --git a/stdlib/2and3/macpath.pyi b/stdlib/2and3/macpath.pyi index 09663afa4..c0bf57658 100644 --- a/stdlib/2and3/macpath.pyi +++ b/stdlib/2and3/macpath.pyi @@ -27,7 +27,10 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -altsep: str +if sys.platform == 'win32': + altsep: str +else: + altsep: Optional[str] extsep: str pathsep: str defpath: str diff --git a/stdlib/2and3/ntpath.pyi b/stdlib/2and3/ntpath.pyi index 09663afa4..c0bf57658 100644 --- a/stdlib/2and3/ntpath.pyi +++ b/stdlib/2and3/ntpath.pyi @@ -27,7 +27,10 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -altsep: str +if sys.platform == 'win32': + altsep: str +else: + altsep: Optional[str] extsep: str pathsep: str defpath: str diff --git a/stdlib/2and3/posixpath.pyi b/stdlib/2and3/posixpath.pyi index 09663afa4..c0bf57658 100644 --- a/stdlib/2and3/posixpath.pyi +++ b/stdlib/2and3/posixpath.pyi @@ -27,7 +27,10 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -altsep: str +if sys.platform == 'win32': + altsep: str +else: + altsep: Optional[str] extsep: str pathsep: str defpath: str diff --git a/stdlib/3/os/__init__.pyi b/stdlib/3/os/__init__.pyi index 2197a4e8c..b71792687 100644 --- a/stdlib/3/os/__init__.pyi +++ b/stdlib/3/os/__init__.pyi @@ -128,7 +128,10 @@ O_LARGEFILE: int # Gnu extension if in C library curdir: str pardir: str sep: str -altsep: str +if sys.platform == 'win32': + altsep: str +else: + altsep: Optional[str] extsep: str pathsep: str defpath: str diff --git a/stdlib/3/os/path.pyi b/stdlib/3/os/path.pyi index 09663afa4..c0bf57658 100644 --- a/stdlib/3/os/path.pyi +++ b/stdlib/3/os/path.pyi @@ -27,7 +27,10 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -altsep: str +if sys.platform == 'win32': + altsep: str +else: + altsep: Optional[str] extsep: str pathsep: str defpath: str