From 22b457e03bf5123c0a407e245567bee940de7cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 16 Jan 2005 08:40:58 +0000 Subject: Added SEEK_* constants. Fixes #711830. --- Doc/lib/libos.tex | 9 +++++++++ Lib/os.py | 9 ++++++++- Misc/NEWS | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex index b1c06b1..995e432 100644 --- a/Doc/lib/libos.tex +++ b/Doc/lib/libos.tex @@ -636,6 +636,15 @@ These can be bit-wise OR'd together. Availability: Windows. \end{datadesc} +\begin{datadesc}{SEEK_SET} +\dataline{SEEK_CUR} +\dataline{SEEK_END} +Parameteters to the \function{lseek()} function. +Their values are 0, 1, and 2, respectively. +Availability: Windows, Macintosh, \UNIX. +\versionadded{2.5} +\end{datadesc} + \subsection{Files and Directories \label{os-file-dir}} \begin{funcdesc}{access}{path, mode} diff --git a/Lib/os.py b/Lib/os.py index 65b1830..d3b9a8d 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -29,7 +29,8 @@ _names = sys.builtin_module_names # Note: more names are added to __all__ later. __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep", - "defpath", "name", "path", "devnull"] + "defpath", "name", "path", "devnull", + "SEEK_SET", "SEEK_CUR", "SEEK_END"] def _get_exports_list(module): try: @@ -135,6 +136,12 @@ from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, del _names +# Python uses fixed values for the SEEK_ constants; they are mapped +# to native constants if necessary in posixmodule.c +SEEK_SET = 0 +SEEK_CUR = 1 +SEEK_END = 2 + #' # Super directory utilities. diff --git a/Misc/NEWS b/Misc/NEWS index 6385157..0492392 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,8 @@ Extension Modules Library ------- +- os.{SEEK_SET, SEEK_CUR, SEEK_END} have been added for convenience. + - Enhancements to the csv module: + Dialects are now validated by the underlying C code, better -- cgit v0.12