Skip to content

Commit 3662864

Browse files
committed
Add OSError note to Path.glob() and Path.rglob()
1 parent ada51b0 commit 3662864

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Doc/library/pathlib.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,11 @@ Reading directories
13391339
The paths are returned in no particular order.
13401340
If you need a specific order, sort the results.
13411341

1342+
.. note::
1343+
Any :exc:`OSError` exceptions raised from scanning the filesystem are
1344+
suppressed. This includes :exc:`PermissionError` when accessing
1345+
directories without read permission.
1346+
13421347
.. seealso::
13431348
:ref:`pathlib-pattern-language` documentation.
13441349

@@ -1377,6 +1382,11 @@ Reading directories
13771382
The paths are returned in no particular order.
13781383
If you need a specific order, sort the results.
13791384

1385+
.. note::
1386+
Any :exc:`OSError` exceptions raised from scanning the filesystem are
1387+
suppressed. This includes :exc:`PermissionError` when accessing
1388+
directories without read permission.
1389+
13801390
.. seealso::
13811391
:ref:`pathlib-pattern-language` and :meth:`Path.glob` documentation.
13821392

@@ -1391,11 +1401,6 @@ Reading directories
13911401
.. versionchanged:: 3.13
13921402
The *pattern* parameter accepts a :term:`path-like object`.
13931403

1394-
.. versionchanged:: 3.13
1395-
Any :exc:`OSError` exceptions raised from scanning the filesystem are
1396-
suppressed. In previous versions, such exceptions are suppressed in many
1397-
cases, but not all.
1398-
13991404

14001405
.. method:: Path.walk(top_down=True, on_error=None, follow_symlinks=False)
14011406

0 commit comments

Comments
 (0)