Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc9e7e4

Browse files
committed
readlink() description: Added note that the return value may be either
absolute or relative. remove(), rename() descriptions: Give more information about the cross- platform behavior of these functions, so single-platform developers can be aware of the potential issues when writing portable code. This closes SF patch #426598.
1 parent 25916bd commit dc9e7e4

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

Doc/lib/libos.tex

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -650,14 +650,20 @@ \subsection{Files and Directories \label{os-file-dir}}
650650

651651
\begin{funcdesc}{readlink}{path}
652652
Return a string representing the path to which the symbolic link
653-
points.
653+
points. The result may be either an absolute or relative pathname; if
654+
it is relative, it may be converted to an absolute pathname using
655+
\code{os.path.join(os.path.dirname(\var{path}), \var{result})}.
654656
Availability: \UNIX{}.
655657
\end{funcdesc}
656658

657659
\begin{funcdesc}{remove}{path}
658-
Remove the file \var{path}. See \function{rmdir()} below to remove a
659-
directory. This is identical to the \function{unlink()} function
660-
documented below.
660+
Remove the file \var{path}. If \var{path} is a directory,
661+
\exception{OSError} is raised; see \function{rmdir()} below to remove
662+
a directory. This is identical to the \function{unlink()} function
663+
documented below. On Windows, attempting to remove a file that is in
664+
use causes an exception to be raised; on \UNIX, the directory entry is
665+
removed but the storage allocated to the file is not made available
666+
until the original file is no longer in use.
661667
Availability: Macintosh, \UNIX{}, Windows.
662668
\end{funcdesc}
663669

@@ -674,7 +680,16 @@ \subsection{Files and Directories \label{os-file-dir}}
674680
\end{funcdesc}
675681

676682
\begin{funcdesc}{rename}{src, dst}
677-
Rename the file or directory \var{src} to \var{dst}.
683+
Rename the file or directory \var{src} to \var{dst}. If \var{dst} is
684+
a directory, \exception{OSError} will be raised. On \UNIX, if
685+
\var{dst} exists and is a file, it will be removed silently if the
686+
user has permission. The operation may fail on some \UNIX{} flavors
687+
is \var{src} and \var{dst} are on different filesystems. If
688+
successful, the renaming will be an atomic operation (this is a
689+
\POSIX{} requirement). On Windows, if \var{dst} already exists,
690+
\exception{OSError} will be raised even if it is a file; there may be
691+
no way to implement an atomic rename when \var{dst} names an existing
692+
file.
678693
Availability: Macintosh, \UNIX{}, Windows.
679694
\end{funcdesc}
680695

0 commit comments

Comments
 (0)