@@ -61,6 +61,9 @@ the :mod:`glob` module.)
6161 platforms, this is equivalent to calling the function :func: `normpath ` as
6262 follows: ``normpath(join(os.getcwd(), path)) ``.
6363
64+ .. versionchanged :: 3.6
65+ Accepts a :term: `path-like object `.
66+
6467
6568.. function :: basename(path)
6669
@@ -71,6 +74,9 @@ the :mod:`glob` module.)
7174 ``'/foo/bar/' `` returns ``'bar' ``, the :func: `basename ` function returns an
7275 empty string (``'' ``).
7376
77+ .. versionchanged :: 3.6
78+ Accepts a :term: `path-like object `.
79+
7480
7581.. function :: commonpath(paths)
7682
@@ -83,6 +89,9 @@ the :mod:`glob` module.)
8389
8490 .. versionadded :: 3.5
8591
92+ .. versionchanged :: 3.6
93+ Accepts a sequence of :term: `path-like objects <path-like object> `.
94+
8695
8796.. function :: commonprefix(list)
8897
@@ -104,12 +113,18 @@ the :mod:`glob` module.)
104113 >>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])
105114 '/usr'
106115
116+ .. versionchanged :: 3.6
117+ Accepts a :term: `path-like object `.
118+
107119
108120.. function :: dirname(path)
109121
110122 Return the directory name of pathname *path *. This is the first element of
111123 the pair returned by passing *path * to the function :func: `split `.
112124
125+ .. versionchanged :: 3.6
126+ Accepts a :term: `path-like object `.
127+
113128
114129.. function :: exists(path)
115130
@@ -123,13 +138,19 @@ the :mod:`glob` module.)
123138 *path * can now be an integer: ``True `` is returned if it is an
124139 open file descriptor, ``False `` otherwise.
125140
141+ .. versionchanged :: 3.6
142+ Accepts a :term: `path-like object `.
143+
126144
127145.. function :: lexists(path)
128146
129147 Return ``True `` if *path * refers to an existing path. Returns ``True `` for
130148 broken symbolic links. Equivalent to :func: `exists ` on platforms lacking
131149 :func: `os.lstat `.
132150
151+ .. versionchanged :: 3.6
152+ Accepts a :term: `path-like object `.
153+
133154
134155.. function :: expanduser(path)
135156
@@ -151,6 +172,9 @@ the :mod:`glob` module.)
151172 If the expansion fails or if the path does not begin with a tilde, the path is
152173 returned unchanged.
153174
175+ .. versionchanged :: 3.6
176+ Accepts a :term: `path-like object `.
177+
154178
155179.. function :: expandvars(path)
156180
@@ -162,6 +186,9 @@ the :mod:`glob` module.)
162186 On Windows, ``%name% `` expansions are supported in addition to ``$name `` and
163187 ``${name} ``.
164188
189+ .. versionchanged :: 3.6
190+ Accepts a :term: `path-like object `.
191+
165192
166193.. function :: getatime(path)
167194
@@ -182,6 +209,9 @@ the :mod:`glob` module.)
182209 If :func: `os.stat_float_times ` returns ``True ``, the result is a floating point
183210 number.
184211
212+ .. versionchanged :: 3.6
213+ Accepts a :term: `path-like object `.
214+
185215
186216.. function :: getctime(path)
187217
@@ -191,37 +221,55 @@ the :mod:`glob` module.)
191221 the :mod: `time ` module). Raise :exc: `OSError ` if the file does not exist or
192222 is inaccessible.
193223
224+ .. versionchanged :: 3.6
225+ Accepts a :term: `path-like object `.
226+
194227
195228.. function :: getsize(path)
196229
197230 Return the size, in bytes, of *path *. Raise :exc: `OSError ` if the file does
198231 not exist or is inaccessible.
199232
233+ .. versionchanged :: 3.6
234+ Accepts a :term: `path-like object `.
235+
200236
201237.. function :: isabs(path)
202238
203239 Return ``True `` if *path * is an absolute pathname. On Unix, that means it
204240 begins with a slash, on Windows that it begins with a (back)slash after chopping
205241 off a potential drive letter.
206242
243+ .. versionchanged :: 3.6
244+ Accepts a :term: `path-like object `.
245+
207246
208247.. function :: isfile(path)
209248
210249 Return ``True `` if *path * is an existing regular file. This follows symbolic
211250 links, so both :func: `islink ` and :func: `isfile ` can be true for the same path.
212251
252+ .. versionchanged :: 3.6
253+ Accepts a :term: `path-like object `.
254+
213255
214256.. function :: isdir(path)
215257
216258 Return ``True `` if *path * is an existing directory. This follows symbolic
217259 links, so both :func: `islink ` and :func: `isdir ` can be true for the same path.
218260
261+ .. versionchanged :: 3.6
262+ Accepts a :term: `path-like object `.
263+
219264
220265.. function :: islink(path)
221266
222267 Return ``True `` if *path * refers to a directory entry that is a symbolic link.
223268 Always ``False `` if symbolic links are not supported by the Python runtime.
224269
270+ .. versionchanged :: 3.6
271+ Accepts a :term: `path-like object `.
272+
225273
226274.. function :: ismount(path)
227275
@@ -237,6 +285,9 @@ the :mod:`glob` module.)
237285 .. versionadded :: 3.4
238286 Support for detecting non-root mount points on Windows.
239287
288+ .. versionchanged :: 3.6
289+ Accepts a :term: `path-like object `.
290+
240291
241292.. function :: join(path, *paths)
242293
@@ -255,13 +306,20 @@ the :mod:`glob` module.)
255306 ``os.path.join("c:", "foo") `` represents a path relative to the current
256307 directory on drive :file: `C: ` (:file: `c:foo `), not :file: `c:\\ foo `.
257308
309+ .. versionchanged :: 3.6
310+ Accepts a :term: `path-like object ` for *path * and *paths *.
311+
258312
259313.. function :: normcase(path)
260314
261315 Normalize the case of a pathname. On Unix and Mac OS X, this returns the
262316 path unchanged; on case-insensitive filesystems, it converts the path to
263317 lowercase. On Windows, it also converts forward slashes to backward slashes.
264- Raise a TypeError if the type of *path * is not ``str `` or ``bytes ``.
318+ Raise a TypeError if the type of *path * is not ``str `` or ``bytes `` (directly
319+ or indirectly through the :class: `os.PathLike ` interface).
320+
321+ .. versionchanged :: 3.6
322+ Accepts a :term: `path-like object `.
265323
266324
267325.. function :: normpath(path)
@@ -272,12 +330,18 @@ the :mod:`glob` module.)
272330 that contains symbolic links. On Windows, it converts forward slashes to
273331 backward slashes. To normalize case, use :func: `normcase `.
274332
333+ .. versionchanged :: 3.6
334+ Accepts a :term: `path-like object `.
335+
275336
276337.. function :: realpath(path)
277338
278339 Return the canonical path of the specified filename, eliminating any symbolic
279340 links encountered in the path (if they are supported by the operating system).
280341
342+ .. versionchanged :: 3.6
343+ Accepts a :term: `path-like object `.
344+
281345
282346.. function :: relpath(path, start=os.curdir)
283347
@@ -290,6 +354,9 @@ the :mod:`glob` module.)
290354
291355 Availability: Unix, Windows.
292356
357+ .. versionchanged :: 3.6
358+ Accepts a :term: `path-like object `.
359+
293360
294361.. function :: samefile(path1, path2)
295362
@@ -305,6 +372,9 @@ the :mod:`glob` module.)
305372 .. versionchanged :: 3.4
306373 Windows now uses the same implementation as all other platforms.
307374
375+ .. versionchanged :: 3.6
376+ Accepts a :term: `path-like object `.
377+
308378
309379.. function :: sameopenfile(fp1, fp2)
310380
@@ -315,6 +385,9 @@ the :mod:`glob` module.)
315385 .. versionchanged :: 3.2
316386 Added Windows support.
317387
388+ .. versionchanged :: 3.6
389+ Accepts a :term: `path-like object `.
390+
318391
319392.. function :: samestat(stat1, stat2)
320393
@@ -328,6 +401,9 @@ the :mod:`glob` module.)
328401 .. versionchanged :: 3.4
329402 Added Windows support.
330403
404+ .. versionchanged :: 3.6
405+ Accepts a :term: `path-like object `.
406+
331407
332408.. function :: split(path)
333409
@@ -341,6 +417,9 @@ the :mod:`glob` module.)
341417 (but the strings may differ). Also see the functions :func: `dirname ` and
342418 :func: `basename `.
343419
420+ .. versionchanged :: 3.6
421+ Accepts a :term: `path-like object `.
422+
344423
345424.. function :: splitdrive(path)
346425
@@ -359,6 +438,9 @@ the :mod:`glob` module.)
359438 and share, up to but not including the fourth separator.
360439 e.g. ``splitdrive("//host/computer/dir") `` returns ``("//host/computer", "/dir") ``
361440
441+ .. versionchanged :: 3.6
442+ Accepts a :term: `path-like object `.
443+
362444
363445.. function :: splitext(path)
364446
@@ -367,6 +449,9 @@ the :mod:`glob` module.)
367449 period. Leading periods on the basename are ignored; ``splitext('.cshrc') ``
368450 returns ``('.cshrc', '') ``.
369451
452+ .. versionchanged :: 3.6
453+ Accepts a :term: `path-like object `.
454+
370455
371456.. function :: splitunc(path)
372457
0 commit comments