Skip to content

Commit ea21227

Browse files
srittauJelleZijlstra
authored andcommitted
os.path.exists (Py 3) accepts a file descriptor (#2451)
Closes #1653
1 parent cca6ee4 commit ea21227

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

stdlib/2/os/path.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ elif sys.version_info >= (3, 5):
100100
# So, fall back to Any
101101
def commonprefix(list: Sequence[_PathType]) -> Any: ...
102102

103-
def exists(path: _PathType) -> bool: ...
103+
if sys.version_info >= (3, 3):
104+
def exists(path: Union[_PathType, int]) -> bool: ...
105+
else:
106+
def exists(path: _PathType) -> bool: ...
104107
def lexists(path: _PathType) -> bool: ...
105108

106109
# These return float if os.stat_float_times() == True,

stdlib/3/os/path.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ elif sys.version_info >= (3, 5):
100100
# So, fall back to Any
101101
def commonprefix(list: Sequence[_PathType]) -> Any: ...
102102

103-
def exists(path: _PathType) -> bool: ...
103+
if sys.version_info >= (3, 3):
104+
def exists(path: Union[_PathType, int]) -> bool: ...
105+
else:
106+
def exists(path: _PathType) -> bool: ...
104107
def lexists(path: _PathType) -> bool: ...
105108

106109
# These return float if os.stat_float_times() == True,

0 commit comments

Comments
 (0)