@@ -59,15 +59,13 @@ \section{\module{os} ---
5959\function {unlink()}), the exception instance will contain a third
6060attribute, \member {filename}, which is the file name passed to the
6161function.
62-
63- When exceptions are strings, the string for the exception is
64- \code {'OSError'}.
6562\end {excdesc }
6663
6764\begin {datadesc }{name}
6865The name of the operating system dependent module imported. The
69- following names have currently been registered: \code {'posix'}, \code {'nt'},
70- \code {'dos'}, \code {'mac'}, \code {'os2'}, \code {'ce'}, \code {'java'}.
66+ following names have currently been registered: \code {'posix'},
67+ \code {'nt'}, \code {'dos'}, \code {'mac'}, \code {'os2'}, \code {'ce'},
68+ \code {'java'}, \code {'riscos'}.
7169\end {datadesc }
7270
7371\begin {datadesc }{path}
@@ -745,49 +743,89 @@ \subsection{Files and Directories \label{os-file-dir}}
745743
746744\begin {funcdesc }{stat}{path}
747745Perform a \cfunction {stat()} system call on the given path. The
748- return value is a tuple of at least 10 integers giving the most
749- important (and portable) members of the \emph {stat } structure, in the
746+ return value is an object whose attributes correspond to the members of
747+ the \ctype {stat} structure, namely:
748+ \member {st_mode} (protection bits),
749+ \member {st_ino} (inode number),
750+ \member {st_dev} (device),
751+ \member {st_nlink} (number of hard links,
752+ \member {st_uid} (user ID of owner),
753+ \member {st_gid} (group ID of owner),
754+ \member {st_size} (size of file, in bytes),
755+ \member {st_atime} (time of most recent access),
756+ \member {st_mtime} (time of most recent content modification),
757+ \member {st_ctime}
758+ (time of most recent content modification or metadata change).
759+
760+ On some Unix systems (such as Linux), the following attributes may
761+ also be available:
762+ \member {st_blocks} (number of blocks allocated for file),
763+ \member {st_blksize} (filesystem blocksize),
764+ \member {st_rdev} (type of device if an inode device).
765+
766+ On Mac OS systems, the following attributes may also be available:
767+ \member {st_rsize},
768+ \member {st_creator},
769+ \member {st_type}.
770+
771+ On RISCOS systems, the following attributes are also available:
772+ \member {st_ftype} (file type),
773+ \member {st_attrs} (attributes),
774+ \member {st_obtype} (object type).
775+
776+ For backward compatibility, the return value of \function {stat()} is
777+ also accessible as a tuple of at least 10 integers giving the most
778+ important (and portable) members of the \ctype {stat} structure, in the
750779order
751- \code {st_mode},
752- \code {st_ino},
753- \code {st_dev},
754- \code {st_nlink},
755- \code {st_uid},
756- \code {st_gid},
757- \code {st_size},
758- \code {st_atime},
759- \code {st_mtime},
760- \code {st_ctime}.
780+ \member {st_mode},
781+ \member {st_ino},
782+ \member {st_dev},
783+ \member {st_nlink},
784+ \member {st_uid},
785+ \member {st_gid},
786+ \member {st_size},
787+ \member {st_atime},
788+ \member {st_mtime},
789+ \member {st_ctime}.
761790More items may be added at the end by some implementations. Note that
762791on the Mac OS, the time values are floating point values, like all
763792time values on the Mac OS.
793+ The standard module \refmodule {stat}\refstmodindex {stat} defines
794+ functions and constants that are useful for extracting information
795+ from a \ctype {stat} structure.
764796(On Windows, some items are filled with dummy values.)
765797Availability: Macintosh, \UNIX , Windows.
766798
767- Note: The standard module \refmodule {stat}\refstmodindex {stat} defines
768- functions and constants that are useful for extracting information
769- from a \ctype {stat} structure.
799+ \versionchanged
800+ [Added access to values as attributes of the returned object]{2.2}
770801\end {funcdesc }
771802
772803\begin {funcdesc }{statvfs}{path}
773804Perform a \cfunction {statvfs()} system call on the given path. The
774- return value is a tuple of 10 integers giving the most common
775- members of the \ctype {statvfs} structure, in the order
776- \code {f_bsize},
777- \code {f_frsize},
778- \code {f_blocks},
779- \code {f_bfree},
780- \code {f_bavail},
781- \code {f_files},
782- \code {f_ffree},
783- \code {f_favail},
784- \code {f_flag},
785- \code {f_namemax}.
805+ return value is an object whose attributes describe the filesystem on
806+ the given path, and correspond to the members of the
807+ \ctype {statvfs} structure, namely:
808+ \member {f_frsize},
809+ \member {f_blocks},
810+ \member {f_bfree},
811+ \member {f_bavail},
812+ \member {f_files},
813+ \member {f_ffree},
814+ \member {f_favail},
815+ \member {f_flag},
816+ \member {f_namemax}.
786817Availability: \UNIX .
787818
788- Note: The standard module \module {statvfs}\refstmodindex {statvfs}
819+ For backward compatibility, the return value is also accessible as a
820+ tuple whose values correspond to the attributes, in the order given above.
821+ The standard module \refmodule {statvfs}\refstmodindex {statvfs}
789822defines constants that are useful for extracting information
790- from a \ctype {statvfs} structure.
823+ from a \ctype {statvfs} structure when accessing it as a sequence; this
824+ remains useful when writing code that needs to work with versions of
825+ Python that don't support accessing the fields as attributes.
826+
827+ \versionchanged
828+ [Added access to values as attributes of the returned object]{2.2}
791829\end {funcdesc }
792830
793831\begin {funcdesc }{symlink}{src, dst}
@@ -933,7 +971,7 @@ \subsection{Process Management \label{os-process}}
933971Fork a child process, using a new pseudo-terminal as the child's
934972controlling terminal. Return a pair of \code {(\var {pid}, \var {fd})},
935973where \var {pid} is \code {0} in the child, the new child's process id
936- in the parent, and \code {fd} is the file descriptor of the master end
974+ in the parent, and \var {fd} is the file descriptor of the master end
937975of the pseudo-terminal. For a more portable approach, use the
938976\refmodule {pty} module.
939977Availability: Some flavors of \UNIX .
@@ -1266,13 +1304,14 @@ \subsection{Miscellaneous System Information \label{os-path}}
12661304\end {datadesc }
12671305
12681306\begin {datadesc }{defpath}
1269- The default search path used by \function {exec*p*()} if the environment
1270- doesn't have a \code {'PATH'} key.
1307+ The default search path used by \function {exec*p*()} and
1308+ \function {spawn*p*()} if the environment doesn't have a \code {'PATH'}
1309+ key.
12711310\end {datadesc }
12721311
12731312\begin {datadesc }{linesep}
12741313The string used to separate (or, rather, terminate) lines on the
12751314current platform. This may be a single character, such as \code {'\e
1276- n'} for \POSIX {} or \code {'\e r'} for the Mac OS, or multiple characters,
1315+ n'} for \POSIX {} or \code {'\e r'} for Mac OS, or multiple characters,
12771316for example, \code {'\e r\e n'} for DOS and Windows.
12781317\end {datadesc }
0 commit comments