]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
More bytes vs. strings documentation.
authorMartin v. Löwis <martin@v.loewis.de>
Tue, 7 Oct 2008 07:03:04 +0000 (07:03 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Tue, 7 Oct 2008 07:03:04 +0000 (07:03 +0000)
Doc/library/functions.rst
Doc/library/os.path.rst
Doc/library/os.rst

index 1fdbeec2421ff675844c201db893fc53668424b3..7fe925847cee28473759c1f07b16497bd27b6f1c 100644 (file)
@@ -710,10 +710,11 @@ are always available.  They are listed here in alphabetical order.
 
    Open a file.  If the file cannot be opened, :exc:`IOError` is raised.
    
-   *file* is either a string giving the name (and the path if the file isn't in
-   the current working directory) of the file to be opened or an integer file
-   descriptor of the file to be wrapped.  (If a file descriptor is given, it is
-   closed when the returned I/O object is closed, unless *closefd* is set to
+   *file* is either a string or bytes object giving the name (and the
+   path if the file isn't in the current working directory) of the
+   file to be opened or an integer file descriptor of the file to be
+   wrapped.  (If a file descriptor is given, it is closed when the
+   returned I/O object is closed, unless *closefd* is set to
    ``False``.)
 
    *mode* is an optional string that specifies the mode in which the file is
index 9bf5ae75fc814b43a1378dbaaed8a7592c2f4a90..71eeb533bc98638b957d42123b31e33501218816 100644 (file)
 
 This module implements some useful functions on pathnames. To read or
 write files see :func:`open`, and for accessing the filesystem see the
-:mod:`os` module.
+:mod:`os` module. The path parameters can be passed as either strings,
+or bytes. Applications are encouraged to represent file names as
+(Unicode) character strings. Unfortunately, some file names may not be
+representable as strings on Unix, so applications that need to support
+arbitrary file names on Unix should use bytes objects to represent
+path names. Vice versa, using bytes objects cannot represent all file
+names on Windows (in the standard ``mbcs`` encoding), hence Windows
+applications should use string objects to access all files.
 
 .. warning::
 
index 0fd4094e9ef0c4a1c5dcafec9d3dd28c6417c1b3..14ad8f92d61fdf7ca96aca3a53964b75ae91f453 100644 (file)
@@ -694,6 +694,8 @@ Files and Directories
 .. function:: getcwd()
 
    Return a string representing the current working directory.
+   May raise UnicodeDecodeError if the current directory path fails
+   to decode in the file system encoding.
    Availability: Unix, Windows.