- Add support for PathLike to _PathType for Python 3.6 Unions only (#1165)

This commit is contained in:
Cooper Lees
2017-04-21 10:13:33 -07:00
committed by Łukasz Langa
parent 55dc338bbf
commit 6e1d915944
2 changed files with 7 additions and 2 deletions

View File

@@ -118,7 +118,7 @@ TMP_MAX = 0 # Undocumented, but used by tempfile
if sys.version_info >= (3, 6):
from builtins import _PathLike as PathLike # See comment in builtins
_PathType = Union[bytes, Text]
_PathType = path._PathType
if sys.version_info >= (3, 6):
class DirEntry(PathLike[AnyStr]):

View File

@@ -10,7 +10,12 @@ from typing import (
)
_T = TypeVar('_T')
_PathType = Union[bytes, Text]
if sys.version_info >= (3, 6):
from builtins import _PathLike
_PathType = Union[bytes, Text, _PathLike]
else:
_PathType = Union[bytes, Text]
# ----- os.path variables -----
supports_unicode_filenames = False