@@ -352,10 +352,26 @@ the :mod:`glob` module.)
352352 links encountered in the path (if they are supported by the operating
353353 system).
354354
355- If a path doesn't exist or a symlink loop is encountered, and *strict * is
356- ``True ``, :exc: `OSError ` is raised. If *strict * is ``False ``, the path is
357- resolved as far as possible and any remainder is appended without checking
358- whether it exists.
355+ By default, the path is evaluated up to the first component that does not
356+ exist, is a symlink loop, or whose evaluation raises :exc: `OSError `.
357+ All such components are appended unchanged to the existing part of the path.
358+
359+ Some errors that are handled this way include "access denied", "not a
360+ directory", or "bad argument to internal function". Thus, the
361+ resulting path may be missing or inaccessible, may still contain
362+ links or loops, and may traverse non-directories.
363+
364+ This behavior can be modified by keyword arguments:
365+
366+ If *strict * is ``True ``, the first error encountered when evaluating the path is
367+ re-raised.
368+ In particular, :exc: `FileNotFoundError ` is raised if *path * does not exist,
369+ or another :exc: `OSError ` if it is otherwise inaccessible.
370+
371+ If *strict * is :py:data: `os.path.ALLOW_MISSING `, errors other than
372+ :exc: `FileNotFoundError ` are re-raised (as with ``strict=True ``).
373+ Thus, the returned path will not contain any symbolic links, but the named
374+ file and some of its parent directories may be missing.
359375
360376 .. note ::
361377 This function emulates the operating system's procedure for making a path
@@ -374,6 +390,15 @@ the :mod:`glob` module.)
374390 .. versionchanged :: 3.10
375391 The *strict * parameter was added.
376392
393+ .. versionchanged :: 3.10.18
394+ The :py:data: `~os.path.ALLOW_MISSING ` value for the *strict * parameter
395+ was added.
396+
397+ .. data :: ALLOW_MISSING
398+
399+ Special value used for the *strict * argument in :func: `realpath `.
400+
401+ .. versionadded :: 3.10.18
377402
378403.. function :: relpath(path, start=os.curdir)
379404
0 commit comments