2007-08-15 11:28:22 -03:00
|
|
|
:mod:`os` --- Miscellaneous operating system interfaces
|
|
|
|
=======================================================
|
|
|
|
|
|
|
|
.. module:: os
|
|
|
|
:synopsis: Miscellaneous operating system interfaces.
|
|
|
|
|
2016-06-11 16:02:54 -03:00
|
|
|
**Source code:** :source:`Lib/os.py`
|
|
|
|
|
|
|
|
--------------
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 15:39:10 -04:00
|
|
|
This module provides a portable way of using operating system dependent
|
|
|
|
functionality. If you just want to read or write a file see :func:`open`, if
|
|
|
|
you want to manipulate paths, see the :mod:`os.path` module, and if you want to
|
|
|
|
read all the lines in all the files on the command line see the :mod:`fileinput`
|
|
|
|
module. For creating temporary files and directories see the :mod:`tempfile`
|
|
|
|
module, and for high-level file and directory handling see the :mod:`shutil`
|
|
|
|
module.
|
|
|
|
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
Notes on the availability of these functions:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
* The design of all built-in operating system dependent modules of Python is
|
|
|
|
such that as long as the same functionality is available, it uses the same
|
|
|
|
interface; for example, the function ``os.stat(path)`` returns stat
|
|
|
|
information about *path* in the same format (which happens to have originated
|
|
|
|
with the POSIX interface).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
* Extensions peculiar to a particular operating system are also available
|
|
|
|
through the :mod:`os` module, but using them is of course a threat to
|
|
|
|
portability.
|
2008-10-08 13:34:57 -03:00
|
|
|
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
* All functions accepting path or file names accept both bytes and string
|
|
|
|
objects, and result in an object of the same type, if a path or file name is
|
|
|
|
returned.
|
2008-10-08 13:34:57 -03:00
|
|
|
|
2020-12-15 17:20:07 -04:00
|
|
|
* On VxWorks, os.popen, os.fork, os.execv and os.spawn*p* are not supported.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
* On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, large
|
|
|
|
parts of the :mod:`os` module are not available or behave differently. API
|
|
|
|
related to processes (e.g. :func:`~os.fork`, :func:`~os.execve`), signals
|
|
|
|
(e.g. :func:`~os.kill`, :func:`~os.wait`), and resources
|
|
|
|
(e.g. :func:`~os.nice`) are not available. Others like :func:`~os.getuid`
|
|
|
|
and :func:`~os.getpid` are emulated or stubs.
|
|
|
|
|
|
|
|
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 15:39:10 -04:00
|
|
|
.. note::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-07-05 05:41:35 -03:00
|
|
|
All functions in this module raise :exc:`OSError` (or subclasses thereof) in
|
|
|
|
the case of invalid or inaccessible file names and paths, or other arguments
|
|
|
|
that have the correct type, but are not accepted by the operating system.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. exception:: error
|
|
|
|
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 15:39:10 -04:00
|
|
|
An alias for the built-in :exc:`OSError` exception.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: name
|
|
|
|
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
The name of the operating system dependent module imported. The following
|
2014-06-27 03:40:06 -03:00
|
|
|
names have currently been registered: ``'posix'``, ``'nt'``,
|
2016-09-05 19:11:23 -03:00
|
|
|
``'java'``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-07-09 10:54:23 -03:00
|
|
|
.. seealso::
|
2023-07-21 06:34:30 -03:00
|
|
|
:data:`sys.platform` has a finer granularity. :func:`os.uname` gives
|
2011-07-09 10:54:23 -03:00
|
|
|
system-dependent version information.
|
|
|
|
|
|
|
|
The :mod:`platform` module provides detailed checks for the
|
|
|
|
system's identity.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-05-05 01:43:17 -03:00
|
|
|
.. _os-filenames:
|
2014-06-19 07:50:27 -03:00
|
|
|
.. _filesystem-encoding:
|
2009-05-05 01:43:17 -03:00
|
|
|
|
|
|
|
File Names, Command Line Arguments, and Environment Variables
|
|
|
|
-------------------------------------------------------------
|
|
|
|
|
2010-08-17 12:07:14 -03:00
|
|
|
In Python, file names, command line arguments, and environment variables are
|
|
|
|
represented using the string type. On some systems, decoding these strings to
|
|
|
|
and from bytes is necessary before passing them to the operating system. Python
|
2020-11-02 11:49:54 -04:00
|
|
|
uses the :term:`filesystem encoding and error handler` to perform this
|
|
|
|
conversion (see :func:`sys.getfilesystemencoding`).
|
|
|
|
|
|
|
|
The :term:`filesystem encoding and error handler` are configured at Python
|
|
|
|
startup by the :c:func:`PyConfig_Read` function: see
|
|
|
|
:c:member:`~PyConfig.filesystem_encoding` and
|
|
|
|
:c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`.
|
2009-05-05 01:43:17 -03:00
|
|
|
|
|
|
|
.. versionchanged:: 3.1
|
2010-08-17 12:07:14 -03:00
|
|
|
On some systems, conversion using the file system encoding may fail. In this
|
2014-08-01 07:28:48 -03:00
|
|
|
case, Python uses the :ref:`surrogateescape encoding error handler
|
|
|
|
<surrogateescape>`, which means that undecodable bytes are replaced by a
|
2023-09-23 03:31:20 -03:00
|
|
|
Unicode character U+DC\ *xx* on decoding, and these are again
|
|
|
|
translated to the original byte on encoding.
|
2009-05-05 01:43:17 -03:00
|
|
|
|
|
|
|
|
2020-11-02 11:49:54 -04:00
|
|
|
The :term:`file system encoding <filesystem encoding and error handler>` must
|
|
|
|
guarantee to successfully decode all bytes below 128. If the file system
|
|
|
|
encoding fails to provide this guarantee, API functions can raise
|
|
|
|
:exc:`UnicodeError`.
|
|
|
|
|
|
|
|
See also the :term:`locale encoding`.
|
|
|
|
|
|
|
|
|
|
|
|
.. _utf8-mode:
|
|
|
|
|
|
|
|
Python UTF-8 Mode
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
.. versionadded:: 3.7
|
|
|
|
See :pep:`540` for more details.
|
|
|
|
|
|
|
|
The Python UTF-8 Mode ignores the :term:`locale encoding` and forces the usage
|
|
|
|
of the UTF-8 encoding:
|
|
|
|
|
|
|
|
* Use UTF-8 as the :term:`filesystem encoding <filesystem encoding and error
|
|
|
|
handler>`.
|
2022-04-21 22:39:24 -03:00
|
|
|
* :func:`sys.getfilesystemencoding()` returns ``'utf-8'``.
|
|
|
|
* :func:`locale.getpreferredencoding()` returns ``'utf-8'`` (the *do_setlocale*
|
2020-11-02 11:49:54 -04:00
|
|
|
argument has no effect).
|
|
|
|
* :data:`sys.stdin`, :data:`sys.stdout`, and :data:`sys.stderr` all use
|
|
|
|
UTF-8 as their text encoding, with the ``surrogateescape``
|
|
|
|
:ref:`error handler <error-handlers>` being enabled for :data:`sys.stdin`
|
|
|
|
and :data:`sys.stdout` (:data:`sys.stderr` continues to use
|
|
|
|
``backslashreplace`` as it does in the default locale-aware mode)
|
2022-04-21 22:39:24 -03:00
|
|
|
* On Unix, :func:`os.device_encoding` returns ``'utf-8'`` rather than the
|
2020-11-04 06:20:10 -04:00
|
|
|
device encoding.
|
2020-11-02 11:49:54 -04:00
|
|
|
|
|
|
|
Note that the standard stream settings in UTF-8 mode can be overridden by
|
|
|
|
:envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware
|
|
|
|
mode).
|
|
|
|
|
|
|
|
As a consequence of the changes in those lower level APIs, other higher
|
|
|
|
level APIs also exhibit different default behaviours:
|
|
|
|
|
|
|
|
* Command line arguments, environment variables and filenames are decoded
|
|
|
|
to text using the UTF-8 encoding.
|
|
|
|
* :func:`os.fsdecode()` and :func:`os.fsencode()` use the UTF-8 encoding.
|
|
|
|
* :func:`open()`, :func:`io.open()`, and :func:`codecs.open()` use the UTF-8
|
|
|
|
encoding by default. However, they still use the strict error handler by
|
|
|
|
default so that attempting to open a binary file in text mode is likely
|
|
|
|
to raise an exception rather than producing nonsense data.
|
|
|
|
|
|
|
|
The :ref:`Python UTF-8 Mode <utf8-mode>` is enabled if the LC_CTYPE locale is
|
|
|
|
``C`` or ``POSIX`` at Python startup (see the :c:func:`PyConfig_Read`
|
|
|
|
function).
|
|
|
|
|
|
|
|
It can be enabled or disabled using the :option:`-X utf8 <-X>` command line
|
|
|
|
option and the :envvar:`PYTHONUTF8` environment variable.
|
|
|
|
|
|
|
|
If the :envvar:`PYTHONUTF8` environment variable is not set at all, then the
|
|
|
|
interpreter defaults to using the current locale settings, *unless* the current
|
|
|
|
locale is identified as a legacy ASCII-based locale (as described for
|
|
|
|
:envvar:`PYTHONCOERCECLOCALE`), and locale coercion is either disabled or
|
|
|
|
fails. In such legacy locales, the interpreter will default to enabling UTF-8
|
|
|
|
mode unless explicitly instructed not to do so.
|
|
|
|
|
|
|
|
The Python UTF-8 Mode can only be enabled at the Python startup. Its value
|
|
|
|
can be read from :data:`sys.flags.utf8_mode <sys.flags>`.
|
|
|
|
|
|
|
|
See also the :ref:`UTF-8 mode on Windows <win-utf8-mode>`
|
|
|
|
and the :term:`filesystem encoding and error handler`.
|
2009-05-05 01:43:17 -03:00
|
|
|
|
2022-10-04 19:04:44 -03:00
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
:pep:`686`
|
|
|
|
Python 3.15 will make :ref:`utf8-mode` default.
|
|
|
|
|
2009-05-05 01:43:17 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. _os-procinfo:
|
|
|
|
|
|
|
|
Process Parameters
|
|
|
|
------------------
|
|
|
|
|
|
|
|
These functions and data items provide information and operate on the current
|
|
|
|
process and user.
|
|
|
|
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
.. function:: ctermid()
|
|
|
|
|
|
|
|
Return the filename corresponding to the controlling terminal of the process.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. data:: environ
|
|
|
|
|
2021-10-29 17:18:45 -03:00
|
|
|
A :term:`mapping` object where keys and values are strings that represent
|
|
|
|
the process environment. For example, ``environ['HOME']`` is the pathname
|
|
|
|
of your home directory (on some platforms), and is equivalent to
|
|
|
|
``getenv("HOME")`` in C.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
This mapping is captured the first time the :mod:`os` module is imported,
|
|
|
|
typically during Python startup as part of processing :file:`site.py`. Changes
|
2022-05-02 11:43:32 -03:00
|
|
|
to the environment made after this time are not reflected in :data:`os.environ`,
|
|
|
|
except for changes made by modifying :data:`os.environ` directly.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-01-24 09:05:48 -04:00
|
|
|
This mapping may be used to modify the environment as well as query the
|
|
|
|
environment. :func:`putenv` will be called automatically when the mapping
|
|
|
|
is modified.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-06 19:05:07 -03:00
|
|
|
On Unix, keys and values use :func:`sys.getfilesystemencoding` and
|
|
|
|
``'surrogateescape'`` error handler. Use :data:`environb` if you would like
|
|
|
|
to use a different encoding.
|
|
|
|
|
2023-03-03 06:51:32 -04:00
|
|
|
On Windows, the keys are converted to uppercase. This also applies when
|
|
|
|
getting, setting, or deleting an item. For example,
|
|
|
|
``environ['monty'] = 'python'`` maps the key ``'MONTY'`` to the value
|
|
|
|
``'python'``.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. note::
|
|
|
|
|
2022-05-02 11:43:32 -03:00
|
|
|
Calling :func:`putenv` directly does not change :data:`os.environ`, so it's better
|
|
|
|
to modify :data:`os.environ`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2021-07-26 16:37:31 -03:00
|
|
|
On some platforms, including FreeBSD and macOS, setting ``environ`` may
|
2008-09-13 14:46:05 -03:00
|
|
|
cause memory leaks. Refer to the system documentation for
|
2023-08-19 14:03:26 -03:00
|
|
|
:c:func:`!putenv`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-01-24 09:05:48 -04:00
|
|
|
You can delete items in this mapping to unset environment variables.
|
|
|
|
:func:`unsetenv` will be called automatically when an item is deleted from
|
2022-05-02 11:43:32 -03:00
|
|
|
:data:`os.environ`, and when one of the :meth:`pop` or :meth:`clear` methods is
|
2020-01-24 09:05:48 -04:00
|
|
|
called.
|
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
|
|
|
|
2020-03-13 13:04:43 -03:00
|
|
|
.. versionchanged:: 3.9
|
|
|
|
Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-06 19:05:07 -03:00
|
|
|
.. data:: environb
|
|
|
|
|
2021-10-29 17:18:45 -03:00
|
|
|
Bytes version of :data:`environ`: a :term:`mapping` object where both keys
|
|
|
|
and values are :class:`bytes` objects representing the process environment.
|
|
|
|
:data:`environ` and :data:`environb` are synchronized (modifying
|
|
|
|
:data:`environb` updates :data:`environ`, and vice versa).
|
2010-05-06 19:05:07 -03:00
|
|
|
|
2023-07-21 06:40:37 -03:00
|
|
|
:data:`environb` is only available if :const:`supports_bytes_environ` is
|
2019-11-12 10:57:03 -04:00
|
|
|
``True``.
|
2010-05-06 19:05:07 -03:00
|
|
|
|
2010-05-06 19:09:03 -03:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2020-03-13 13:04:43 -03:00
|
|
|
.. versionchanged:: 3.9
|
|
|
|
Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators.
|
|
|
|
|
2010-05-06 19:05:07 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: chdir(path)
|
|
|
|
fchdir(fd)
|
|
|
|
getcwd()
|
|
|
|
:noindex:
|
|
|
|
|
|
|
|
These functions are described in :ref:`os-file-dir`.
|
|
|
|
|
|
|
|
|
2010-08-18 22:05:19 -03:00
|
|
|
.. function:: fsencode(filename)
|
2010-05-08 08:10:09 -03:00
|
|
|
|
2020-11-02 11:49:54 -04:00
|
|
|
Encode :term:`path-like <path-like object>` *filename* to the
|
|
|
|
:term:`filesystem encoding and error handler`; return :class:`bytes`
|
|
|
|
unchanged.
|
2010-08-18 22:05:19 -03:00
|
|
|
|
2010-09-25 19:12:00 -03:00
|
|
|
:func:`fsdecode` is the reverse function.
|
2010-08-18 22:05:19 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2016-06-09 19:58:06 -03:00
|
|
|
.. versionchanged:: 3.6
|
2016-06-24 16:03:43 -03:00
|
|
|
Support added to accept objects implementing the :class:`os.PathLike`
|
|
|
|
interface.
|
2016-06-09 19:58:06 -03:00
|
|
|
|
2010-08-18 22:05:19 -03:00
|
|
|
|
|
|
|
.. function:: fsdecode(filename)
|
|
|
|
|
2016-06-24 16:21:47 -03:00
|
|
|
Decode the :term:`path-like <path-like object>` *filename* from the
|
2020-11-02 11:49:54 -04:00
|
|
|
:term:`filesystem encoding and error handler`; return :class:`str`
|
|
|
|
unchanged.
|
2010-08-18 22:05:19 -03:00
|
|
|
|
|
|
|
:func:`fsencode` is the reverse function.
|
2010-05-08 08:10:09 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2016-06-09 19:58:06 -03:00
|
|
|
.. versionchanged:: 3.6
|
2016-06-24 16:03:43 -03:00
|
|
|
Support added to accept objects implementing the :class:`os.PathLike`
|
|
|
|
interface.
|
2016-06-09 19:58:06 -03:00
|
|
|
|
2010-05-08 08:10:09 -03:00
|
|
|
|
2016-06-02 19:06:09 -03:00
|
|
|
.. function:: fspath(path)
|
|
|
|
|
2016-06-09 18:37:06 -03:00
|
|
|
Return the file system representation of the path.
|
2016-06-02 19:06:09 -03:00
|
|
|
|
2016-06-24 16:03:43 -03:00
|
|
|
If :class:`str` or :class:`bytes` is passed in, it is returned unchanged.
|
|
|
|
Otherwise :meth:`~os.PathLike.__fspath__` is called and its value is
|
|
|
|
returned as long as it is a :class:`str` or :class:`bytes` object.
|
|
|
|
In all other cases, :exc:`TypeError` is raised.
|
2016-06-02 19:06:09 -03:00
|
|
|
|
2016-06-09 19:58:06 -03:00
|
|
|
.. versionadded:: 3.6
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: PathLike
|
|
|
|
|
|
|
|
An :term:`abstract base class` for objects representing a file system path,
|
|
|
|
e.g. :class:`pathlib.PurePath`.
|
|
|
|
|
2016-06-10 02:43:54 -03:00
|
|
|
.. versionadded:: 3.6
|
|
|
|
|
2016-06-09 19:58:06 -03:00
|
|
|
.. abstractmethod:: __fspath__()
|
|
|
|
|
|
|
|
Return the file system path representation of the object.
|
|
|
|
|
|
|
|
The method should only return a :class:`str` or :class:`bytes` object,
|
|
|
|
with the preference being for :class:`str`.
|
|
|
|
|
2016-06-02 19:06:09 -03:00
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
.. function:: getenv(key, default=None)
|
|
|
|
|
2022-10-10 10:43:01 -03:00
|
|
|
Return the value of the environment variable *key* as a string if it exists, or
|
|
|
|
*default* if it doesn't. *key* is a string. Note that
|
2022-05-02 11:43:32 -03:00
|
|
|
since :func:`getenv` uses :data:`os.environ`, the mapping of :func:`getenv` is
|
|
|
|
similarly also captured on import, and the function may not reflect
|
|
|
|
future environment changes.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding`
|
|
|
|
and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you
|
|
|
|
would like to use a different encoding.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: getenvb(key, default=None)
|
|
|
|
|
2022-10-10 10:43:01 -03:00
|
|
|
Return the value of the environment variable *key* as bytes if it exists, or
|
|
|
|
*default* if it doesn't. *key* must be bytes. Note that
|
2022-05-02 11:43:32 -03:00
|
|
|
since :func:`getenvb` uses :data:`os.environb`, the mapping of :func:`getenvb` is
|
|
|
|
similarly also captured on import, and the function may not reflect
|
|
|
|
future environment changes.
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2023-07-21 06:40:37 -03:00
|
|
|
:func:`getenvb` is only available if :const:`supports_bytes_environ`
|
2019-11-12 10:57:03 -04:00
|
|
|
is ``True``.
|
2016-09-26 16:44:07 -03:00
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Unix.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
|
|
|
|
2010-02-27 03:22:22 -04:00
|
|
|
.. function:: get_exec_path(env=None)
|
|
|
|
|
|
|
|
Returns the list of directories that will be searched for a named
|
|
|
|
executable, similar to a shell, when launching a process.
|
|
|
|
*env*, when specified, should be an environment variable dictionary
|
|
|
|
to lookup the PATH in.
|
2016-10-19 10:29:26 -03:00
|
|
|
By default, when *env* is ``None``, :data:`environ` is used.
|
2010-02-27 03:22:22 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: getegid()
|
|
|
|
|
|
|
|
Return the effective group id of the current process. This corresponds to the
|
2010-05-06 20:03:05 -03:00
|
|
|
"set id" bit on the file being executed in the current process.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: geteuid()
|
|
|
|
|
|
|
|
.. index:: single: user; effective id
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Return the current process's effective user id.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: getgid()
|
|
|
|
|
|
|
|
.. index:: single: process; group
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Return the real group id of the current process.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is a stub on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: getgrouplist(user, group, /)
|
2011-06-10 02:30:30 -03:00
|
|
|
|
|
|
|
Return list of group ids that *user* belongs to. If *group* is not in the
|
|
|
|
list, it is included; typically, *group* is specified as the group ID
|
2022-04-15 00:55:07 -03:00
|
|
|
field from the password record for *user*, because that group ID will
|
|
|
|
otherwise be potentially omitted.
|
2011-06-10 02:30:30 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2011-06-10 02:30:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: getgroups()
|
|
|
|
|
|
|
|
Return list of supplemental group ids associated with the current process.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-03-16 01:13:56 -03:00
|
|
|
.. note::
|
|
|
|
|
2021-07-26 16:37:31 -03:00
|
|
|
On macOS, :func:`getgroups` behavior differs somewhat from
|
2012-04-30 15:14:02 -03:00
|
|
|
other Unix platforms. If the Python interpreter was built with a
|
2023-07-28 07:26:28 -03:00
|
|
|
deployment target of ``10.5`` or earlier, :func:`getgroups` returns
|
2012-04-30 15:14:02 -03:00
|
|
|
the list of effective group ids associated with the current user process;
|
|
|
|
this list is limited to a system-defined number of entries, typically 16,
|
|
|
|
and may be modified by calls to :func:`setgroups` if suitably privileged.
|
2023-07-28 07:26:28 -03:00
|
|
|
If built with a deployment target greater than ``10.5``,
|
2012-04-30 15:14:02 -03:00
|
|
|
:func:`getgroups` returns the current group access list for the user
|
|
|
|
associated with the effective user id of the process; the group access
|
|
|
|
list may change over the lifetime of the process, it is not affected by
|
|
|
|
calls to :func:`setgroups`, and its length is not limited to 16. The
|
|
|
|
deployment target value, :const:`MACOSX_DEPLOYMENT_TARGET`, can be
|
|
|
|
obtained with :func:`sysconfig.get_config_var`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getlogin()
|
|
|
|
|
|
|
|
Return the name of the user logged in on the controlling terminal of the
|
2018-01-24 13:51:29 -04:00
|
|
|
process. For most purposes, it is more useful to use
|
|
|
|
:func:`getpass.getuser` since the latter checks the environment variables
|
|
|
|
:envvar:`LOGNAME` or :envvar:`USERNAME` to find out who the user is, and
|
|
|
|
falls back to ``pwd.getpwuid(os.getuid())[0]`` to get the login name of the
|
|
|
|
current real user id.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, Windows, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: getpgid(pid)
|
|
|
|
|
|
|
|
Return the process group id of the process with process id *pid*. If *pid* is 0,
|
2010-05-06 20:03:05 -03:00
|
|
|
the process group id of the current process is returned.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getpgrp()
|
|
|
|
|
|
|
|
.. index:: single: process; group
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Return the id of the current process group.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: getpid()
|
|
|
|
|
|
|
|
.. index:: single: process; id
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Return the current process id.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is a stub on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getppid()
|
|
|
|
|
|
|
|
.. index:: single: process; id of parent
|
|
|
|
|
2010-09-07 18:31:17 -03:00
|
|
|
Return the parent's process id. When the parent process has exited, on Unix
|
|
|
|
the id returned is the one of the init process (1), on Windows it is still
|
|
|
|
the same id, which may be already reused by another process.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, Windows, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-09-07 18:31:17 -03:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Added support for Windows.
|
2009-11-28 07:12:26 -04:00
|
|
|
|
2012-06-24 08:29:09 -03:00
|
|
|
|
2011-02-25 16:57:54 -04:00
|
|
|
.. function:: getpriority(which, who)
|
|
|
|
|
|
|
|
.. index:: single: process; scheduling priority
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
Get program scheduling priority. The value *which* is one of
|
2011-02-25 16:57:54 -04:00
|
|
|
:const:`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who*
|
|
|
|
is interpreted relative to *which* (a process identifier for
|
|
|
|
:const:`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, and a
|
2012-06-24 07:50:06 -03:00
|
|
|
user ID for :const:`PRIO_USER`). A zero value for *who* denotes
|
2011-02-25 16:57:54 -04:00
|
|
|
(respectively) the calling process, the process group of the calling process,
|
|
|
|
or the real user ID of the calling process.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: PRIO_PROCESS
|
|
|
|
PRIO_PGRP
|
|
|
|
PRIO_USER
|
|
|
|
|
|
|
|
Parameters for the :func:`getpriority` and :func:`setpriority` functions.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2011-02-25 16:57:54 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2023-05-19 04:15:11 -03:00
|
|
|
.. data:: PRIO_DARWIN_THREAD
|
|
|
|
PRIO_DARWIN_PROCESS
|
|
|
|
PRIO_DARWIN_BG
|
|
|
|
PRIO_DARWIN_NONUI
|
|
|
|
|
|
|
|
Parameters for the :func:`getpriority` and :func:`setpriority` functions.
|
|
|
|
|
|
|
|
.. availability:: macOS
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
2009-11-27 13:54:17 -04:00
|
|
|
.. function:: getresuid()
|
2009-11-27 10:09:49 -04:00
|
|
|
|
|
|
|
Return a tuple (ruid, euid, suid) denoting the current process's
|
2010-05-06 20:03:05 -03:00
|
|
|
real, effective, and saved user ids.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2009-11-27 10:09:49 -04:00
|
|
|
|
2009-11-28 07:12:26 -04:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2009-11-27 10:09:49 -04:00
|
|
|
|
2009-11-27 13:54:17 -04:00
|
|
|
.. function:: getresgid()
|
2009-11-27 10:09:49 -04:00
|
|
|
|
|
|
|
Return a tuple (rgid, egid, sgid) denoting the current process's
|
2010-09-05 14:07:12 -03:00
|
|
|
real, effective, and saved group ids.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2009-11-27 10:09:49 -04:00
|
|
|
|
2009-11-28 07:12:26 -04:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: getuid()
|
|
|
|
|
|
|
|
.. index:: single: user; id
|
|
|
|
|
2014-06-07 17:50:34 -03:00
|
|
|
Return the current process's real user id.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is a stub on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: initgroups(username, gid, /)
|
2010-05-06 19:05:07 -03:00
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
Call the system initgroups() to initialize the group access list with all of
|
|
|
|
the groups of which the specified username is a member, plus the specified
|
|
|
|
group id.
|
2010-05-06 19:13:11 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-06 19:13:11 -03:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: putenv(key, value, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. index:: single: environment variables; setting
|
|
|
|
|
2009-09-02 17:34:52 -03:00
|
|
|
Set the environment variable named *key* to the string *value*. Such
|
2007-08-15 11:28:22 -03:00
|
|
|
changes to the environment affect subprocesses started with :func:`os.system`,
|
2010-05-06 20:03:05 -03:00
|
|
|
:func:`popen` or :func:`fork` and :func:`execv`.
|
|
|
|
|
2022-05-02 11:43:32 -03:00
|
|
|
Assignments to items in :data:`os.environ` are automatically translated into
|
2020-01-24 09:05:48 -04:00
|
|
|
corresponding calls to :func:`putenv`; however, calls to :func:`putenv`
|
2022-05-02 11:43:32 -03:00
|
|
|
don't update :data:`os.environ`, so it is actually preferable to assign to items
|
|
|
|
of :data:`os.environ`. This also applies to :func:`getenv` and :func:`getenvb`, which
|
|
|
|
respectively use :data:`os.environ` and :data:`os.environb` in their implementations.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2021-07-26 16:37:31 -03:00
|
|
|
On some platforms, including FreeBSD and macOS, setting ``environ`` may
|
2023-08-19 14:03:26 -03:00
|
|
|
cause memory leaks. Refer to the system documentation for :c:func:`!putenv`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.putenv key,value os.putenv
|
|
|
|
|
2020-01-24 09:05:48 -04:00
|
|
|
.. versionchanged:: 3.9
|
|
|
|
The function is now always available.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: setegid(egid, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Set the current process's effective group id.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: seteuid(euid, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Set the current process's effective user id.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: setgid(gid, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Set the current process' group id.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: setgroups(groups, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Set the list of supplemental group ids associated with the current process to
|
|
|
|
*groups*. *groups* must be a sequence, and each element must be an integer
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
identifying a group. This operation is typically available only to the superuser.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2021-07-26 16:37:31 -03:00
|
|
|
.. note:: On macOS, the length of *groups* may not exceed the
|
2012-04-30 15:14:02 -03:00
|
|
|
system-defined maximum number of effective group ids, typically 16.
|
|
|
|
See the documentation for :func:`getgroups` for cases where it may not
|
|
|
|
return the same group list set by calling setgroups().
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-10-20 06:08:54 -03:00
|
|
|
.. function:: setns(fd, nstype=0)
|
|
|
|
|
|
|
|
Reassociate the current thread with a Linux namespace.
|
|
|
|
See the :manpage:`setns(2)` and :manpage:`namespaces(7)` man pages for more
|
|
|
|
details.
|
|
|
|
|
|
|
|
If *fd* refers to a :file:`/proc/{pid}/ns/` link, ``setns()`` reassociates the
|
|
|
|
calling thread with the namespace associated with that link,
|
|
|
|
and *nstype* may be set to one of the
|
|
|
|
:ref:`CLONE_NEW* constants <os-unshare-clone-flags>`
|
|
|
|
to impose constraints on the operation
|
|
|
|
(``0`` means no constraints).
|
|
|
|
|
|
|
|
Since Linux 5.8, *fd* may refer to a PID file descriptor obtained from
|
|
|
|
:func:`~os.pidfd_open`. In this case, ``setns()`` reassociates the calling thread
|
|
|
|
into one or more of the same namespaces as the thread referred to by *fd*.
|
|
|
|
This is subject to any constraints imposed by *nstype*,
|
|
|
|
which is a bit mask combining one or more of the
|
|
|
|
:ref:`CLONE_NEW* constants <os-unshare-clone-flags>`,
|
|
|
|
e.g. ``setns(fd, os.CLONE_NEWUTS | os.CLONE_NEWPID)``.
|
|
|
|
The caller's memberships in unspecified namespaces are left unchanged.
|
|
|
|
|
|
|
|
*fd* can be any object with a :meth:`~io.IOBase.fileno` method, or a raw file descriptor.
|
|
|
|
|
|
|
|
This example reassociates the thread with the ``init`` process's network namespace::
|
|
|
|
|
|
|
|
fd = os.open("/proc/1/ns/net", os.O_RDONLY)
|
|
|
|
os.setns(fd, os.CLONE_NEWNET)
|
|
|
|
os.close(fd)
|
|
|
|
|
|
|
|
.. availability:: Linux >= 3.0 with glibc >= 2.14.
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
The :func:`~os.unshare` function.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: setpgrp()
|
|
|
|
|
2023-08-19 14:03:26 -03:00
|
|
|
Call the system call :c:func:`!setpgrp` or ``setpgrp(0, 0)`` depending on
|
2007-08-15 11:28:22 -03:00
|
|
|
which version is implemented (if any). See the Unix manual for the semantics.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: setpgid(pid, pgrp, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-08-19 14:03:26 -03:00
|
|
|
Call the system call :c:func:`!setpgid` to set the process group id of the
|
2007-08-15 11:28:22 -03:00
|
|
|
process with id *pid* to the process group with id *pgrp*. See the Unix manual
|
2010-05-06 20:03:05 -03:00
|
|
|
for the semantics.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2011-02-25 16:57:54 -04:00
|
|
|
.. function:: setpriority(which, who, priority)
|
|
|
|
|
|
|
|
.. index:: single: process; scheduling priority
|
|
|
|
|
|
|
|
Set program scheduling priority. The value *which* is one of
|
|
|
|
:const:`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who*
|
|
|
|
is interpreted relative to *which* (a process identifier for
|
|
|
|
:const:`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, and a
|
|
|
|
user ID for :const:`PRIO_USER`). A zero value for *who* denotes
|
|
|
|
(respectively) the calling process, the process group of the calling process,
|
|
|
|
or the real user ID of the calling process.
|
|
|
|
*priority* is a value in the range -20 to 19. The default priority is 0;
|
|
|
|
lower priorities cause more favorable scheduling.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2011-02-25 16:57:54 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: setregid(rgid, egid, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Set the current process's real and effective group ids.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-11-28 07:12:26 -04:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: setresgid(rgid, egid, sgid, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-11-27 10:09:49 -04:00
|
|
|
Set the current process's real, effective, and saved group ids.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-11-28 07:12:26 -04:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2009-11-27 10:09:49 -04:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: setresuid(ruid, euid, suid, /)
|
2009-11-27 10:09:49 -04:00
|
|
|
|
|
|
|
Set the current process's real, effective, and saved user ids.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2009-11-27 10:09:49 -04:00
|
|
|
|
2009-11-28 07:12:26 -04:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2009-11-27 10:09:49 -04:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: setreuid(ruid, euid, /)
|
2009-11-27 10:09:49 -04:00
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Set the current process's real and effective user ids.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: getsid(pid, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-07-23 17:56:56 -03:00
|
|
|
Call the system call :c:func:`!getsid`. See the Unix manual for the semantics.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: setsid()
|
|
|
|
|
2023-07-23 17:56:56 -03:00
|
|
|
Call the system call :c:func:`!setsid`. See the Unix manual for the semantics.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: setuid(uid, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. index:: single: user; id, setting
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Set the current process's user id.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 12:14:33 -04:00
|
|
|
.. placed in this section since it relates to errno.... a little weak
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: strerror(code, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return the error message corresponding to the error code in *code*.
|
2023-07-23 17:56:56 -03:00
|
|
|
On platforms where :c:func:`!strerror` returns ``NULL`` when given an unknown
|
2010-05-06 20:03:05 -03:00
|
|
|
error number, :exc:`ValueError` is raised.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-18 14:17:23 -03:00
|
|
|
.. data:: supports_bytes_environ
|
|
|
|
|
2013-11-29 06:17:13 -04:00
|
|
|
``True`` if the native OS type of the environment is bytes (eg. ``False`` on
|
2010-05-18 14:17:23 -03:00
|
|
|
Windows).
|
|
|
|
|
2010-05-18 14:24:09 -03:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2010-05-18 14:17:23 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: umask(mask, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Set the current numeric umask and return the previous umask.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is a stub on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: uname()
|
|
|
|
|
|
|
|
.. index::
|
|
|
|
single: gethostname() (in module socket)
|
|
|
|
single: gethostbyaddr() (in module socket)
|
|
|
|
|
2012-06-24 08:33:36 -03:00
|
|
|
Returns information identifying the current operating system.
|
|
|
|
The return value is an object with five attributes:
|
|
|
|
|
|
|
|
* :attr:`sysname` - operating system name
|
|
|
|
* :attr:`nodename` - name of machine on network (implementation-defined)
|
|
|
|
* :attr:`release` - operating system release
|
|
|
|
* :attr:`version` - operating system version
|
|
|
|
* :attr:`machine` - hardware identifier
|
|
|
|
|
|
|
|
For backwards compatibility, this object is also iterable, behaving
|
|
|
|
like a five-tuple containing :attr:`sysname`, :attr:`nodename`,
|
|
|
|
:attr:`release`, :attr:`version`, and :attr:`machine`
|
|
|
|
in that order.
|
|
|
|
|
|
|
|
Some systems truncate :attr:`nodename` to 8 characters or to the
|
2007-08-15 11:28:22 -03:00
|
|
|
leading component; a better way to get the hostname is
|
|
|
|
:func:`socket.gethostname` or even
|
2010-05-06 20:03:05 -03:00
|
|
|
``socket.gethostbyaddr(socket.gethostname())``.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 08:33:36 -03:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
Return type changed from a tuple to a tuple-like object
|
|
|
|
with named attributes.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: unsetenv(key, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. index:: single: environment variables; deleting
|
|
|
|
|
2009-09-02 17:34:52 -03:00
|
|
|
Unset (delete) the environment variable named *key*. Such changes to the
|
2007-08-15 11:28:22 -03:00
|
|
|
environment affect subprocesses started with :func:`os.system`, :func:`popen` or
|
2010-05-06 20:03:05 -03:00
|
|
|
:func:`fork` and :func:`execv`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-05-02 11:43:32 -03:00
|
|
|
Deletion of items in :data:`os.environ` is automatically translated into a
|
2020-01-24 09:05:48 -04:00
|
|
|
corresponding call to :func:`unsetenv`; however, calls to :func:`unsetenv`
|
2022-05-02 11:43:32 -03:00
|
|
|
don't update :data:`os.environ`, so it is actually preferable to delete items of
|
|
|
|
:data:`os.environ`.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.unsetenv key os.unsetenv
|
|
|
|
|
2020-01-24 06:53:44 -04:00
|
|
|
.. versionchanged:: 3.9
|
2020-01-24 09:05:48 -04:00
|
|
|
The function is now always available and is also available on Windows.
|
2020-01-24 06:53:44 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-10-20 06:08:54 -03:00
|
|
|
.. function:: unshare(flags)
|
|
|
|
|
|
|
|
Disassociate parts of the process execution context, and move them into a
|
|
|
|
newly created namespace.
|
|
|
|
See the :manpage:`unshare(2)`
|
|
|
|
man page for more details.
|
|
|
|
The *flags* argument is a bit mask, combining zero or more of the
|
|
|
|
:ref:`CLONE_* constants <os-unshare-clone-flags>`,
|
|
|
|
that specifies which parts of the execution context should be
|
|
|
|
unshared from their existing associations and moved to a new namespace.
|
|
|
|
If the *flags* argument is ``0``, no changes are made to the calling process's
|
|
|
|
execution context.
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.16.
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
The :func:`~os.setns` function.
|
|
|
|
|
|
|
|
.. _os-unshare-clone-flags:
|
|
|
|
|
|
|
|
Flags to the :func:`unshare` function, if the implementation supports them.
|
|
|
|
See :manpage:`unshare(2)` in the Linux manual
|
|
|
|
for their exact effect and availability.
|
|
|
|
|
|
|
|
.. data:: CLONE_FILES
|
|
|
|
CLONE_FS
|
|
|
|
CLONE_NEWCGROUP
|
|
|
|
CLONE_NEWIPC
|
|
|
|
CLONE_NEWNET
|
|
|
|
CLONE_NEWNS
|
|
|
|
CLONE_NEWPID
|
|
|
|
CLONE_NEWTIME
|
|
|
|
CLONE_NEWUSER
|
|
|
|
CLONE_NEWUTS
|
|
|
|
CLONE_SIGHAND
|
|
|
|
CLONE_SYSVSEM
|
|
|
|
CLONE_THREAD
|
|
|
|
CLONE_VM
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. _os-newstreams:
|
|
|
|
|
|
|
|
File Object Creation
|
|
|
|
--------------------
|
|
|
|
|
2019-05-23 12:45:22 -03:00
|
|
|
These functions create new :term:`file objects <file object>`. (See also
|
2012-06-24 08:24:56 -03:00
|
|
|
:func:`~os.open` for opening file descriptors.)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2012-05-24 15:44:07 -03:00
|
|
|
.. function:: fdopen(fd, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 08:24:56 -03:00
|
|
|
Return an open file object connected to the file descriptor *fd*. This is an
|
|
|
|
alias of the :func:`open` built-in function and accepts the same arguments.
|
|
|
|
The only difference is that the first argument of :func:`fdopen` must always
|
|
|
|
be an integer.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. _os-fd-ops:
|
|
|
|
|
|
|
|
File Descriptor Operations
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
These functions operate on I/O streams referenced using file descriptors.
|
|
|
|
|
|
|
|
File descriptors are small integers corresponding to a file that has been opened
|
|
|
|
by the current process. For example, standard input is usually file descriptor
|
|
|
|
0, standard output is 1, and standard error is 2. Further files opened by a
|
|
|
|
process will then be assigned 3, 4, 5, and so forth. The name "file descriptor"
|
|
|
|
is slightly deceptive; on Unix platforms, sockets and pipes are also referenced
|
|
|
|
by file descriptors.
|
|
|
|
|
2013-10-13 14:12:43 -03:00
|
|
|
The :meth:`~io.IOBase.fileno` method can be used to obtain the file descriptor
|
2010-09-15 08:11:28 -03:00
|
|
|
associated with a :term:`file object` when required. Note that using the file
|
Merged revisions 79307,79408,79430,79533,79542,79579-79580,79585-79587,79607-79608,79622,79717,79820,79822,79828,79862,79875,79923-79924,79941-79943,79945,79947,79951-79952 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79307 | florent.xicluna | 2010-03-22 17:45:50 -0500 (Mon, 22 Mar 2010) | 2 lines
#7667: Fix doctest failures with non-ASCII paths.
........
r79408 | victor.stinner | 2010-03-24 20:18:38 -0500 (Wed, 24 Mar 2010) | 2 lines
Fix a gcc warning introduced by r79397.
........
r79430 | brian.curtin | 2010-03-25 18:48:54 -0500 (Thu, 25 Mar 2010) | 2 lines
Fix #6538. Markup RegexObject and MatchObject as classes. Patch by Ryan Arana.
........
r79533 | barry.warsaw | 2010-03-31 16:07:16 -0500 (Wed, 31 Mar 2010) | 6 lines
- Issue #8233: When run as a script, py_compile.py optionally takes a single
argument `-` which tells it to read files to compile from stdin. Each line
is read on demand and the named file is compiled immediately. (Original
patch by Piotr O?\197?\188arowski).
........
r79542 | r.david.murray | 2010-03-31 20:28:39 -0500 (Wed, 31 Mar 2010) | 3 lines
A couple small grammar fixes in test.rst, and rewrite the
check_warnings docs to be clearer.
........
r79579 | georg.brandl | 2010-04-02 03:34:41 -0500 (Fri, 02 Apr 2010) | 1 line
Add 2.6.5.
........
r79580 | georg.brandl | 2010-04-02 03:39:09 -0500 (Fri, 02 Apr 2010) | 1 line
#2768: add a note on how to get a file descriptor.
........
r79585 | georg.brandl | 2010-04-02 04:03:18 -0500 (Fri, 02 Apr 2010) | 1 line
Remove col-spanning cells in logging docs.
........
r79586 | georg.brandl | 2010-04-02 04:07:42 -0500 (Fri, 02 Apr 2010) | 1 line
Document PyImport_ExecCodeModuleEx().
........
r79587 | georg.brandl | 2010-04-02 04:11:49 -0500 (Fri, 02 Apr 2010) | 1 line
#8012: clarification in generator glossary entry.
........
r79607 | andrew.kuchling | 2010-04-02 12:48:23 -0500 (Fri, 02 Apr 2010) | 1 line
#6647: document that catch_warnings is not thread-safe
........
r79608 | andrew.kuchling | 2010-04-02 12:54:26 -0500 (Fri, 02 Apr 2010) | 1 line
#6647: add note to two examples
........
r79622 | tarek.ziade | 2010-04-02 16:34:19 -0500 (Fri, 02 Apr 2010) | 1 line
removed documentation on code that was reverted and pushed into distutils2
........
r79717 | antoine.pitrou | 2010-04-03 16:22:38 -0500 (Sat, 03 Apr 2010) | 4 lines
Fix wording / typography, and a slightly misleading statement
(memoryviews don't support complex structures right now)
........
r79820 | benjamin.peterson | 2010-04-05 22:34:09 -0500 (Mon, 05 Apr 2010) | 1 line
ready _sre types
........
r79822 | georg.brandl | 2010-04-06 03:18:15 -0500 (Tue, 06 Apr 2010) | 1 line
#8320: document return value of recv_into().
........
r79828 | georg.brandl | 2010-04-06 09:33:44 -0500 (Tue, 06 Apr 2010) | 1 line
Add JP.
........
r79862 | georg.brandl | 2010-04-06 15:27:59 -0500 (Tue, 06 Apr 2010) | 1 line
Fix syntax.
........
r79875 | mark.dickinson | 2010-04-06 17:18:23 -0500 (Tue, 06 Apr 2010) | 1 line
More NaN consistency doc fixes.
........
r79923 | georg.brandl | 2010-04-10 06:15:24 -0500 (Sat, 10 Apr 2010) | 1 line
#8360: skipTest was added in 2.7.
........
r79924 | georg.brandl | 2010-04-10 06:16:59 -0500 (Sat, 10 Apr 2010) | 1 line
#8346: update version.
........
r79941 | andrew.kuchling | 2010-04-10 20:39:36 -0500 (Sat, 10 Apr 2010) | 1 line
Two grammar fixes
........
r79942 | andrew.kuchling | 2010-04-10 20:40:06 -0500 (Sat, 10 Apr 2010) | 1 line
Punctuation fix
........
r79943 | andrew.kuchling | 2010-04-10 20:40:30 -0500 (Sat, 10 Apr 2010) | 1 line
Add various items
........
r79945 | andrew.kuchling | 2010-04-10 20:40:49 -0500 (Sat, 10 Apr 2010) | 1 line
name correct
........
r79947 | andrew.kuchling | 2010-04-10 20:44:13 -0500 (Sat, 10 Apr 2010) | 1 line
Remove distutils section
........
r79951 | andrew.kuchling | 2010-04-11 07:48:08 -0500 (Sun, 11 Apr 2010) | 1 line
Two typo fixes
........
r79952 | andrew.kuchling | 2010-04-11 07:49:37 -0500 (Sun, 11 Apr 2010) | 1 line
Add two items
........
2010-04-11 13:12:57 -03:00
|
|
|
descriptor directly will bypass the file object methods, ignoring aspects such
|
|
|
|
as internal buffering of data.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-02-25 19:25:17 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: close(fd)
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Close file descriptor *fd*.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
This function is intended for low-level I/O and must be applied to a file
|
Merged revisions 72506,72525-72526,72551,72558,72616,72654-72655,72689,72745,72750,72802,72812,72822,72824,72826-72827,72833,72876,72890,72923,72946,73026,73042,73045,73047,73065,73068-73069 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72506 | vinay.sajip | 2009-05-09 07:07:17 -0500 (Sat, 09 May 2009) | 1 line
Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when trying to print a traceback.
........
r72525 | benjamin.peterson | 2009-05-09 20:38:02 -0500 (Sat, 09 May 2009) | 1 line
close file explicitly
........
r72526 | benjamin.peterson | 2009-05-09 21:29:00 -0500 (Sat, 09 May 2009) | 1 line
make sure files are closed using the with statement
........
r72551 | benjamin.peterson | 2009-05-10 09:16:47 -0500 (Sun, 10 May 2009) | 1 line
use isinstance
........
r72558 | benjamin.peterson | 2009-05-10 18:52:09 -0500 (Sun, 10 May 2009) | 1 line
sys.setdefaultencoding() strikes me as a bad example
........
r72616 | benjamin.peterson | 2009-05-13 19:33:10 -0500 (Wed, 13 May 2009) | 1 line
importlib.import_module is better these days
........
r72654 | benjamin.peterson | 2009-05-14 17:37:49 -0500 (Thu, 14 May 2009) | 1 line
prevent refleaks from threads
........
r72655 | benjamin.peterson | 2009-05-14 17:40:34 -0500 (Thu, 14 May 2009) | 1 line
a useful decorator for cleaning up threads
........
r72689 | benjamin.peterson | 2009-05-16 13:44:34 -0500 (Sat, 16 May 2009) | 1 line
use skipTest()
........
r72745 | benjamin.peterson | 2009-05-17 09:16:29 -0500 (Sun, 17 May 2009) | 1 line
ignore .rst files in sphinx its self
........
r72750 | benjamin.peterson | 2009-05-17 11:59:27 -0500 (Sun, 17 May 2009) | 1 line
chop off slash
........
r72802 | georg.brandl | 2009-05-20 13:35:27 -0500 (Wed, 20 May 2009) | 1 line
#6051: refer to email examples for better way to construct email messages.
........
r72812 | michael.foord | 2009-05-21 17:57:02 -0500 (Thu, 21 May 2009) | 1 line
Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in TestCase subclasses. Issue 6072.
........
r72822 | georg.brandl | 2009-05-22 04:33:25 -0500 (Fri, 22 May 2009) | 1 line
#6084: fix example.
........
r72824 | georg.brandl | 2009-05-22 04:43:17 -0500 (Fri, 22 May 2009) | 1 line
Fix references to file-related functions and methods (os.* vs file.*).
........
r72826 | georg.brandl | 2009-05-22 04:49:42 -0500 (Fri, 22 May 2009) | 1 line
Fix confusing wording.
........
r72827 | georg.brandl | 2009-05-22 04:50:30 -0500 (Fri, 22 May 2009) | 1 line
s/use/call/
........
r72833 | georg.brandl | 2009-05-22 12:00:17 -0500 (Fri, 22 May 2009) | 1 line
#6078: _warnings is a builtin module and has no standard init_warnings function.
........
r72876 | benjamin.peterson | 2009-05-23 15:59:09 -0500 (Sat, 23 May 2009) | 1 line
remove mention of old ctypes version
........
r72890 | gregory.p.smith | 2009-05-24 13:00:13 -0500 (Sun, 24 May 2009) | 2 lines
add a versionadded tag for set_tunnel
........
r72923 | michael.foord | 2009-05-25 15:36:56 -0500 (Mon, 25 May 2009) | 1 line
Make assertSequenceEqual error messages less cryptic, particularly for nested sequences.
........
r72946 | ronald.oussoren | 2009-05-26 13:44:48 -0500 (Tue, 26 May 2009) | 2 lines
Fixes issue 6110
........
r73026 | r.david.murray | 2009-05-29 14:30:27 -0500 (Fri, 29 May 2009) | 3 lines
Issue 6141: document that the first item of args is still the
command name even when executable is specified.
........
r73042 | benjamin.peterson | 2009-05-29 22:10:52 -0500 (Fri, 29 May 2009) | 1 line
no fdatasync on macos
........
r73045 | georg.brandl | 2009-05-30 02:26:04 -0500 (Sat, 30 May 2009) | 1 line
#6146: fix markup bug.
........
r73047 | georg.brandl | 2009-05-30 05:33:23 -0500 (Sat, 30 May 2009) | 1 line
Fix some more small markup problems.
........
r73065 | antoine.pitrou | 2009-05-30 16:39:25 -0500 (Sat, 30 May 2009) | 3 lines
The test for #5330 wasn't correct.
........
r73068 | antoine.pitrou | 2009-05-30 16:45:40 -0500 (Sat, 30 May 2009) | 3 lines
Update ACKS
........
r73069 | benjamin.peterson | 2009-05-30 19:42:42 -0500 (Sat, 30 May 2009) | 1 line
fix signature
........
2009-06-01 19:42:33 -03:00
|
|
|
descriptor as returned by :func:`os.open` or :func:`pipe`. To close a "file
|
2007-08-15 11:28:22 -03:00
|
|
|
object" returned by the built-in function :func:`open` or by :func:`popen` or
|
2013-10-13 14:12:43 -03:00
|
|
|
:func:`fdopen`, use its :meth:`~io.IOBase.close` method.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: closerange(fd_low, fd_high, /)
|
Merged revisions 60094-60123 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
*** NOTE ***
I haven't merged the files in Doc/c-api/. I got too many conflicts. Georg,
please split them manually.
........
r60095 | andrew.kuchling | 2008-01-19 21:12:04 +0100 (Sat, 19 Jan 2008) | 2 lines
Bug 1277: make Maildir use the user-provided factory instead of hard-wiring MaildirMessage.
2.5.2 bugfix candidate.
........
r60097 | georg.brandl | 2008-01-19 21:22:13 +0100 (Sat, 19 Jan 2008) | 4 lines
#1663329: add os.closerange() to close a range of fds,
ignoring errors, and use this in subprocess to speed up
subprocess creation in close_fds mode. Patch by Mike Klaas.
........
r60099 | georg.brandl | 2008-01-19 21:40:24 +0100 (Sat, 19 Jan 2008) | 2 lines
#1411695: clarify behavior of xml.sax.utils.[un]escape.
........
r60101 | andrew.kuchling | 2008-01-19 21:47:59 +0100 (Sat, 19 Jan 2008) | 7 lines
Patch #1019808 from Federico Schwindt: Return correct socket error when
a default timeout has been set, by using getsockopt() to get the error
condition (instead of trying another connect() call, which seems to be
a Linuxism).
2.5 bugfix candidate, assuming no one reports any problems with this change.
........
r60102 | gregory.p.smith | 2008-01-19 21:49:02 +0100 (Sat, 19 Jan 2008) | 3 lines
fix comment typos, use not arg instead of arg == "", add test coverage
for inside of the final if needquotes: within subprocess.list2cmdline().
........
r60103 | georg.brandl | 2008-01-19 21:53:07 +0100 (Sat, 19 Jan 2008) | 2 lines
#1509: fix sqlite3 docstrings and docs w.r.t. cursor.fetchXXX methods.
........
r60104 | gregory.p.smith | 2008-01-19 21:57:59 +0100 (Sat, 19 Jan 2008) | 6 lines
Fixes issue1336 - a race condition could occur when forking if the gc
kicked in during the critical section. solution: disable gc during
that section. Patch contributed by jpa and updated by me to cover the
race condition still existing what therve from twistedmatrix pointed
out (already seen and fixed in twisted's own subprocess code).
........
r60105 | gregory.p.smith | 2008-01-19 22:00:37 +0100 (Sat, 19 Jan 2008) | 2 lines
note about r60104
........
r60106 | andrew.kuchling | 2008-01-19 22:00:38 +0100 (Sat, 19 Jan 2008) | 1 line
Bug 1296: restore text describing OptionGroup
........
r60109 | georg.brandl | 2008-01-19 23:08:21 +0100 (Sat, 19 Jan 2008) | 2 lines
Split the monstrous C API manual files in smaller parts.
........
r60110 | georg.brandl | 2008-01-19 23:14:27 +0100 (Sat, 19 Jan 2008) | 2 lines
Missed one big file to split up.
........
r60111 | gregory.p.smith | 2008-01-19 23:23:56 +0100 (Sat, 19 Jan 2008) | 12 lines
Undo an unnecessary else: and indentation that r60104 added.
try:
...
except:
...
raise
else:
...
the else: is unecessary due to the blind except: with a raise.
........
r60115 | gregory.p.smith | 2008-01-19 23:49:37 +0100 (Sat, 19 Jan 2008) | 3 lines
Fix issue 1300: Quote command line arguments that contain a '|' character in
subprocess.list2cmdline (windows).
........
r60116 | gregory.p.smith | 2008-01-20 00:10:52 +0100 (Sun, 20 Jan 2008) | 3 lines
Fixes/Accepts Patch for issue1189216 - Work properly with archives
that have file headers past the 2**31 byte boundary.
........
r60119 | andrew.kuchling | 2008-01-20 01:00:38 +0100 (Sun, 20 Jan 2008) | 3 lines
Patch #1048820 from Stefan Wehr: add insert-mode editing to Textbox.
Fix an off-by-one error I noticed.
........
r60120 | andrew.kuchling | 2008-01-20 01:12:19 +0100 (Sun, 20 Jan 2008) | 1 line
Add an interactive test script for exercising curses
........
r60121 | gregory.p.smith | 2008-01-20 02:21:03 +0100 (Sun, 20 Jan 2008) | 7 lines
Fix zipfile decryption. The check for validity only worked on one
type of encrypted zip files. Files using extended local headers
needed to compare the check byte against different values. (according
to reading the infozip unzip crypt.c source code)
Fixes issue1003.
........
r60122 | gregory.p.smith | 2008-01-20 02:26:04 +0100 (Sun, 20 Jan 2008) | 2 lines
note for r60121
........
r60123 | gregory.p.smith | 2008-01-20 02:32:00 +0100 (Sun, 20 Jan 2008) | 4 lines
Document that zipfile decryption is insanely slow and fix a typo and
blatant lie in a docstring (it is not useful for security regardless of
how you spell it).
........
2008-01-20 05:06:41 -04:00
|
|
|
|
|
|
|
Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive),
|
2012-06-24 06:54:07 -03:00
|
|
|
ignoring errors. Equivalent to (but much faster than)::
|
Merged revisions 60094-60123 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
*** NOTE ***
I haven't merged the files in Doc/c-api/. I got too many conflicts. Georg,
please split them manually.
........
r60095 | andrew.kuchling | 2008-01-19 21:12:04 +0100 (Sat, 19 Jan 2008) | 2 lines
Bug 1277: make Maildir use the user-provided factory instead of hard-wiring MaildirMessage.
2.5.2 bugfix candidate.
........
r60097 | georg.brandl | 2008-01-19 21:22:13 +0100 (Sat, 19 Jan 2008) | 4 lines
#1663329: add os.closerange() to close a range of fds,
ignoring errors, and use this in subprocess to speed up
subprocess creation in close_fds mode. Patch by Mike Klaas.
........
r60099 | georg.brandl | 2008-01-19 21:40:24 +0100 (Sat, 19 Jan 2008) | 2 lines
#1411695: clarify behavior of xml.sax.utils.[un]escape.
........
r60101 | andrew.kuchling | 2008-01-19 21:47:59 +0100 (Sat, 19 Jan 2008) | 7 lines
Patch #1019808 from Federico Schwindt: Return correct socket error when
a default timeout has been set, by using getsockopt() to get the error
condition (instead of trying another connect() call, which seems to be
a Linuxism).
2.5 bugfix candidate, assuming no one reports any problems with this change.
........
r60102 | gregory.p.smith | 2008-01-19 21:49:02 +0100 (Sat, 19 Jan 2008) | 3 lines
fix comment typos, use not arg instead of arg == "", add test coverage
for inside of the final if needquotes: within subprocess.list2cmdline().
........
r60103 | georg.brandl | 2008-01-19 21:53:07 +0100 (Sat, 19 Jan 2008) | 2 lines
#1509: fix sqlite3 docstrings and docs w.r.t. cursor.fetchXXX methods.
........
r60104 | gregory.p.smith | 2008-01-19 21:57:59 +0100 (Sat, 19 Jan 2008) | 6 lines
Fixes issue1336 - a race condition could occur when forking if the gc
kicked in during the critical section. solution: disable gc during
that section. Patch contributed by jpa and updated by me to cover the
race condition still existing what therve from twistedmatrix pointed
out (already seen and fixed in twisted's own subprocess code).
........
r60105 | gregory.p.smith | 2008-01-19 22:00:37 +0100 (Sat, 19 Jan 2008) | 2 lines
note about r60104
........
r60106 | andrew.kuchling | 2008-01-19 22:00:38 +0100 (Sat, 19 Jan 2008) | 1 line
Bug 1296: restore text describing OptionGroup
........
r60109 | georg.brandl | 2008-01-19 23:08:21 +0100 (Sat, 19 Jan 2008) | 2 lines
Split the monstrous C API manual files in smaller parts.
........
r60110 | georg.brandl | 2008-01-19 23:14:27 +0100 (Sat, 19 Jan 2008) | 2 lines
Missed one big file to split up.
........
r60111 | gregory.p.smith | 2008-01-19 23:23:56 +0100 (Sat, 19 Jan 2008) | 12 lines
Undo an unnecessary else: and indentation that r60104 added.
try:
...
except:
...
raise
else:
...
the else: is unecessary due to the blind except: with a raise.
........
r60115 | gregory.p.smith | 2008-01-19 23:49:37 +0100 (Sat, 19 Jan 2008) | 3 lines
Fix issue 1300: Quote command line arguments that contain a '|' character in
subprocess.list2cmdline (windows).
........
r60116 | gregory.p.smith | 2008-01-20 00:10:52 +0100 (Sun, 20 Jan 2008) | 3 lines
Fixes/Accepts Patch for issue1189216 - Work properly with archives
that have file headers past the 2**31 byte boundary.
........
r60119 | andrew.kuchling | 2008-01-20 01:00:38 +0100 (Sun, 20 Jan 2008) | 3 lines
Patch #1048820 from Stefan Wehr: add insert-mode editing to Textbox.
Fix an off-by-one error I noticed.
........
r60120 | andrew.kuchling | 2008-01-20 01:12:19 +0100 (Sun, 20 Jan 2008) | 1 line
Add an interactive test script for exercising curses
........
r60121 | gregory.p.smith | 2008-01-20 02:21:03 +0100 (Sun, 20 Jan 2008) | 7 lines
Fix zipfile decryption. The check for validity only worked on one
type of encrypted zip files. Files using extended local headers
needed to compare the check byte against different values. (according
to reading the infozip unzip crypt.c source code)
Fixes issue1003.
........
r60122 | gregory.p.smith | 2008-01-20 02:26:04 +0100 (Sun, 20 Jan 2008) | 2 lines
note for r60121
........
r60123 | gregory.p.smith | 2008-01-20 02:32:00 +0100 (Sun, 20 Jan 2008) | 4 lines
Document that zipfile decryption is insanely slow and fix a typo and
blatant lie in a docstring (it is not useful for security regardless of
how you spell it).
........
2008-01-20 05:06:41 -04:00
|
|
|
|
2009-09-01 04:34:27 -03:00
|
|
|
for fd in range(fd_low, fd_high):
|
Merged revisions 60094-60123 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
*** NOTE ***
I haven't merged the files in Doc/c-api/. I got too many conflicts. Georg,
please split them manually.
........
r60095 | andrew.kuchling | 2008-01-19 21:12:04 +0100 (Sat, 19 Jan 2008) | 2 lines
Bug 1277: make Maildir use the user-provided factory instead of hard-wiring MaildirMessage.
2.5.2 bugfix candidate.
........
r60097 | georg.brandl | 2008-01-19 21:22:13 +0100 (Sat, 19 Jan 2008) | 4 lines
#1663329: add os.closerange() to close a range of fds,
ignoring errors, and use this in subprocess to speed up
subprocess creation in close_fds mode. Patch by Mike Klaas.
........
r60099 | georg.brandl | 2008-01-19 21:40:24 +0100 (Sat, 19 Jan 2008) | 2 lines
#1411695: clarify behavior of xml.sax.utils.[un]escape.
........
r60101 | andrew.kuchling | 2008-01-19 21:47:59 +0100 (Sat, 19 Jan 2008) | 7 lines
Patch #1019808 from Federico Schwindt: Return correct socket error when
a default timeout has been set, by using getsockopt() to get the error
condition (instead of trying another connect() call, which seems to be
a Linuxism).
2.5 bugfix candidate, assuming no one reports any problems with this change.
........
r60102 | gregory.p.smith | 2008-01-19 21:49:02 +0100 (Sat, 19 Jan 2008) | 3 lines
fix comment typos, use not arg instead of arg == "", add test coverage
for inside of the final if needquotes: within subprocess.list2cmdline().
........
r60103 | georg.brandl | 2008-01-19 21:53:07 +0100 (Sat, 19 Jan 2008) | 2 lines
#1509: fix sqlite3 docstrings and docs w.r.t. cursor.fetchXXX methods.
........
r60104 | gregory.p.smith | 2008-01-19 21:57:59 +0100 (Sat, 19 Jan 2008) | 6 lines
Fixes issue1336 - a race condition could occur when forking if the gc
kicked in during the critical section. solution: disable gc during
that section. Patch contributed by jpa and updated by me to cover the
race condition still existing what therve from twistedmatrix pointed
out (already seen and fixed in twisted's own subprocess code).
........
r60105 | gregory.p.smith | 2008-01-19 22:00:37 +0100 (Sat, 19 Jan 2008) | 2 lines
note about r60104
........
r60106 | andrew.kuchling | 2008-01-19 22:00:38 +0100 (Sat, 19 Jan 2008) | 1 line
Bug 1296: restore text describing OptionGroup
........
r60109 | georg.brandl | 2008-01-19 23:08:21 +0100 (Sat, 19 Jan 2008) | 2 lines
Split the monstrous C API manual files in smaller parts.
........
r60110 | georg.brandl | 2008-01-19 23:14:27 +0100 (Sat, 19 Jan 2008) | 2 lines
Missed one big file to split up.
........
r60111 | gregory.p.smith | 2008-01-19 23:23:56 +0100 (Sat, 19 Jan 2008) | 12 lines
Undo an unnecessary else: and indentation that r60104 added.
try:
...
except:
...
raise
else:
...
the else: is unecessary due to the blind except: with a raise.
........
r60115 | gregory.p.smith | 2008-01-19 23:49:37 +0100 (Sat, 19 Jan 2008) | 3 lines
Fix issue 1300: Quote command line arguments that contain a '|' character in
subprocess.list2cmdline (windows).
........
r60116 | gregory.p.smith | 2008-01-20 00:10:52 +0100 (Sun, 20 Jan 2008) | 3 lines
Fixes/Accepts Patch for issue1189216 - Work properly with archives
that have file headers past the 2**31 byte boundary.
........
r60119 | andrew.kuchling | 2008-01-20 01:00:38 +0100 (Sun, 20 Jan 2008) | 3 lines
Patch #1048820 from Stefan Wehr: add insert-mode editing to Textbox.
Fix an off-by-one error I noticed.
........
r60120 | andrew.kuchling | 2008-01-20 01:12:19 +0100 (Sun, 20 Jan 2008) | 1 line
Add an interactive test script for exercising curses
........
r60121 | gregory.p.smith | 2008-01-20 02:21:03 +0100 (Sun, 20 Jan 2008) | 7 lines
Fix zipfile decryption. The check for validity only worked on one
type of encrypted zip files. Files using extended local headers
needed to compare the check byte against different values. (according
to reading the infozip unzip crypt.c source code)
Fixes issue1003.
........
r60122 | gregory.p.smith | 2008-01-20 02:26:04 +0100 (Sun, 20 Jan 2008) | 2 lines
note for r60121
........
r60123 | gregory.p.smith | 2008-01-20 02:32:00 +0100 (Sun, 20 Jan 2008) | 4 lines
Document that zipfile decryption is insanely slow and fix a typo and
blatant lie in a docstring (it is not useful for security regardless of
how you spell it).
........
2008-01-20 05:06:41 -04:00
|
|
|
try:
|
|
|
|
os.close(fd)
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-31 15:39:47 -03:00
|
|
|
.. function:: copy_file_range(src, dst, count, offset_src=None, offset_dst=None)
|
|
|
|
|
|
|
|
Copy *count* bytes from file descriptor *src*, starting from offset
|
|
|
|
*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*.
|
|
|
|
If *offset_src* is None, then *src* is read from the current position;
|
2022-06-08 12:49:13 -03:00
|
|
|
respectively for *offset_dst*.
|
|
|
|
|
|
|
|
In Linux kernel older than 5.3, the files pointed by *src* and *dst*
|
2019-05-31 15:39:47 -03:00
|
|
|
must reside in the same filesystem, otherwise an :exc:`OSError` is
|
2023-07-21 06:40:37 -03:00
|
|
|
raised with :attr:`~OSError.errno` set to :const:`errno.EXDEV`.
|
2019-05-31 15:39:47 -03:00
|
|
|
|
|
|
|
This copy is done without the additional cost of transferring data
|
|
|
|
from the kernel to user space and then back into the kernel. Additionally,
|
2022-06-08 12:49:13 -03:00
|
|
|
some filesystems could implement extra optimizations, such as the use of
|
|
|
|
reflinks (i.e., two or more inodes that share pointers to the same
|
|
|
|
copy-on-write disk blocks; supported file systems include btrfs and XFS)
|
|
|
|
and server-side copy (in the case of NFS).
|
|
|
|
|
|
|
|
The function copies bytes between two file descriptors. Text options, like
|
|
|
|
the encoding and the line ending, are ignored.
|
2019-05-31 15:39:47 -03:00
|
|
|
|
|
|
|
The return value is the amount of bytes copied. This could be less than the
|
|
|
|
amount requested.
|
|
|
|
|
2022-06-08 12:49:13 -03:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
On Linux, :func:`os.copy_file_range` should not be used for copying a
|
|
|
|
range of a pseudo file from a special filesystem like procfs and sysfs.
|
|
|
|
It will always copy no bytes and return 0 as if the file was empty
|
|
|
|
because of a known Linux kernel issue.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 4.5 with glibc >= 2.27.
|
2019-05-31 15:39:47 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.8
|
|
|
|
|
|
|
|
|
2007-12-21 04:45:42 -04:00
|
|
|
.. function:: device_encoding(fd)
|
|
|
|
|
|
|
|
Return a string describing the encoding of the device associated with *fd*
|
|
|
|
if it is connected to a terminal; else return :const:`None`.
|
|
|
|
|
2020-11-04 06:20:10 -04:00
|
|
|
On Unix, if the :ref:`Python UTF-8 Mode <utf8-mode>` is enabled, return
|
|
|
|
``'UTF-8'`` rather than the device encoding.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.10
|
|
|
|
On Unix, the function now implements the Python UTF-8 Mode.
|
|
|
|
|
2007-12-21 04:45:42 -04:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: dup(fd, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
Return a duplicate of file descriptor *fd*. The new file descriptor is
|
|
|
|
:ref:`non-inheritable <fd_inheritance>`.
|
|
|
|
|
|
|
|
On Windows, when duplicating a standard stream (0: stdin, 1: stdout,
|
|
|
|
2: stderr), the new file descriptor is :ref:`inheritable
|
|
|
|
<fd_inheritance>`.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: not WASI.
|
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
.. versionchanged:: 3.4
|
|
|
|
The new file descriptor is now non-inheritable.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
.. function:: dup2(fd, fd2, inheritable=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2017-12-29 17:13:06 -04:00
|
|
|
Duplicate file descriptor *fd* to *fd2*, closing the latter first if
|
|
|
|
necessary. Return *fd2*. The new file descriptor is :ref:`inheritable
|
|
|
|
<fd_inheritance>` by default or non-inheritable if *inheritable*
|
|
|
|
is ``False``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: not WASI.
|
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
.. versionchanged:: 3.4
|
|
|
|
Add the optional *inheritable* parameter.
|
|
|
|
|
2017-12-29 17:13:06 -04:00
|
|
|
.. versionchanged:: 3.7
|
|
|
|
Return *fd2* on success. Previously, ``None`` was always returned.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2007-11-30 18:12:06 -04:00
|
|
|
.. function:: fchmod(fd, mode)
|
|
|
|
|
2012-06-24 07:38:14 -03:00
|
|
|
Change the mode of the file given by *fd* to the numeric *mode*. See the
|
2012-06-25 02:40:32 -03:00
|
|
|
docs for :func:`chmod` for possible values of *mode*. As of Python 3.3, this
|
2012-06-24 07:38:14 -03:00
|
|
|
is equivalent to ``os.chmod(fd, mode)``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chmod path,mode,dir_fd os.fchmod
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-11-30 18:12:06 -04:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is limited on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
2007-11-30 18:12:06 -04:00
|
|
|
|
|
|
|
.. function:: fchown(fd, uid, gid)
|
|
|
|
|
|
|
|
Change the owner and group id of the file given by *fd* to the numeric *uid*
|
2012-06-24 07:38:14 -03:00
|
|
|
and *gid*. To leave one of the ids unchanged, set it to -1. See
|
2012-06-25 02:40:32 -03:00
|
|
|
:func:`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid,
|
2012-06-24 07:38:14 -03:00
|
|
|
gid)``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chown path,uid,gid,dir_fd os.fchown
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-11-30 18:12:06 -04:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is limited on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
2007-11-30 18:12:06 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: fdatasync(fd)
|
|
|
|
|
|
|
|
Force write of file with filedescriptor *fd* to disk. Does not force update of
|
2010-05-06 20:03:05 -03:00
|
|
|
metadata.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 72506,72525-72526,72551,72558,72616,72654-72655,72689,72745,72750,72802,72812,72822,72824,72826-72827,72833,72876,72890,72923,72946,73026,73042,73045,73047,73065,73068-73069 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72506 | vinay.sajip | 2009-05-09 07:07:17 -0500 (Sat, 09 May 2009) | 1 line
Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when trying to print a traceback.
........
r72525 | benjamin.peterson | 2009-05-09 20:38:02 -0500 (Sat, 09 May 2009) | 1 line
close file explicitly
........
r72526 | benjamin.peterson | 2009-05-09 21:29:00 -0500 (Sat, 09 May 2009) | 1 line
make sure files are closed using the with statement
........
r72551 | benjamin.peterson | 2009-05-10 09:16:47 -0500 (Sun, 10 May 2009) | 1 line
use isinstance
........
r72558 | benjamin.peterson | 2009-05-10 18:52:09 -0500 (Sun, 10 May 2009) | 1 line
sys.setdefaultencoding() strikes me as a bad example
........
r72616 | benjamin.peterson | 2009-05-13 19:33:10 -0500 (Wed, 13 May 2009) | 1 line
importlib.import_module is better these days
........
r72654 | benjamin.peterson | 2009-05-14 17:37:49 -0500 (Thu, 14 May 2009) | 1 line
prevent refleaks from threads
........
r72655 | benjamin.peterson | 2009-05-14 17:40:34 -0500 (Thu, 14 May 2009) | 1 line
a useful decorator for cleaning up threads
........
r72689 | benjamin.peterson | 2009-05-16 13:44:34 -0500 (Sat, 16 May 2009) | 1 line
use skipTest()
........
r72745 | benjamin.peterson | 2009-05-17 09:16:29 -0500 (Sun, 17 May 2009) | 1 line
ignore .rst files in sphinx its self
........
r72750 | benjamin.peterson | 2009-05-17 11:59:27 -0500 (Sun, 17 May 2009) | 1 line
chop off slash
........
r72802 | georg.brandl | 2009-05-20 13:35:27 -0500 (Wed, 20 May 2009) | 1 line
#6051: refer to email examples for better way to construct email messages.
........
r72812 | michael.foord | 2009-05-21 17:57:02 -0500 (Thu, 21 May 2009) | 1 line
Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in TestCase subclasses. Issue 6072.
........
r72822 | georg.brandl | 2009-05-22 04:33:25 -0500 (Fri, 22 May 2009) | 1 line
#6084: fix example.
........
r72824 | georg.brandl | 2009-05-22 04:43:17 -0500 (Fri, 22 May 2009) | 1 line
Fix references to file-related functions and methods (os.* vs file.*).
........
r72826 | georg.brandl | 2009-05-22 04:49:42 -0500 (Fri, 22 May 2009) | 1 line
Fix confusing wording.
........
r72827 | georg.brandl | 2009-05-22 04:50:30 -0500 (Fri, 22 May 2009) | 1 line
s/use/call/
........
r72833 | georg.brandl | 2009-05-22 12:00:17 -0500 (Fri, 22 May 2009) | 1 line
#6078: _warnings is a builtin module and has no standard init_warnings function.
........
r72876 | benjamin.peterson | 2009-05-23 15:59:09 -0500 (Sat, 23 May 2009) | 1 line
remove mention of old ctypes version
........
r72890 | gregory.p.smith | 2009-05-24 13:00:13 -0500 (Sun, 24 May 2009) | 2 lines
add a versionadded tag for set_tunnel
........
r72923 | michael.foord | 2009-05-25 15:36:56 -0500 (Mon, 25 May 2009) | 1 line
Make assertSequenceEqual error messages less cryptic, particularly for nested sequences.
........
r72946 | ronald.oussoren | 2009-05-26 13:44:48 -0500 (Tue, 26 May 2009) | 2 lines
Fixes issue 6110
........
r73026 | r.david.murray | 2009-05-29 14:30:27 -0500 (Fri, 29 May 2009) | 3 lines
Issue 6141: document that the first item of args is still the
command name even when executable is specified.
........
r73042 | benjamin.peterson | 2009-05-29 22:10:52 -0500 (Fri, 29 May 2009) | 1 line
no fdatasync on macos
........
r73045 | georg.brandl | 2009-05-30 02:26:04 -0500 (Sat, 30 May 2009) | 1 line
#6146: fix markup bug.
........
r73047 | georg.brandl | 2009-05-30 05:33:23 -0500 (Sat, 30 May 2009) | 1 line
Fix some more small markup problems.
........
r73065 | antoine.pitrou | 2009-05-30 16:39:25 -0500 (Sat, 30 May 2009) | 3 lines
The test for #5330 wasn't correct.
........
r73068 | antoine.pitrou | 2009-05-30 16:45:40 -0500 (Sat, 30 May 2009) | 3 lines
Update ACKS
........
r73069 | benjamin.peterson | 2009-05-30 19:42:42 -0500 (Sat, 30 May 2009) | 1 line
fix signature
........
2009-06-01 19:42:33 -03:00
|
|
|
.. note::
|
|
|
|
This function is not available on MacOS.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: fpathconf(fd, name, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return system configuration information relevant to an open file. *name*
|
|
|
|
specifies the configuration value to retrieve; it may be a string which is the
|
|
|
|
name of a defined system value; these names are specified in a number of
|
|
|
|
standards (POSIX.1, Unix 95, Unix 98, and others). Some platforms define
|
|
|
|
additional names as well. The names known to the host operating system are
|
|
|
|
given in the ``pathconf_names`` dictionary. For configuration variables not
|
|
|
|
included in that mapping, passing an integer for *name* is also accepted.
|
|
|
|
|
|
|
|
If *name* is a string and is not known, :exc:`ValueError` is raised. If a
|
|
|
|
specific value for *name* is not supported by the host system, even if it is
|
|
|
|
included in ``pathconf_names``, an :exc:`OSError` is raised with
|
|
|
|
:const:`errno.EINVAL` for the error number.
|
|
|
|
|
2012-06-25 02:40:32 -03:00
|
|
|
As of Python 3.3, this is equivalent to ``os.pathconf(fd, name)``.
|
2012-06-24 07:55:33 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2013-09-19 04:08:56 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-02-08 18:03:19 -04:00
|
|
|
.. function:: fstat(fd)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
Get the status of the file descriptor *fd*. Return a :class:`stat_result`
|
|
|
|
object.
|
|
|
|
|
|
|
|
As of Python 3.3, this is equivalent to ``os.stat(fd)``.
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
2015-04-27 07:53:28 -03:00
|
|
|
The :func:`.stat` function.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2012-06-24 06:54:07 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: fstatvfs(fd, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 07:38:14 -03:00
|
|
|
Return information about the filesystem containing the file associated with
|
2012-06-25 02:40:32 -03:00
|
|
|
file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is
|
2012-06-24 07:38:14 -03:00
|
|
|
equivalent to ``os.statvfs(fd)``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: fsync(fd)
|
|
|
|
|
|
|
|
Force write of file with filedescriptor *fd* to disk. On Unix, this calls the
|
2023-08-19 14:03:26 -03:00
|
|
|
native :c:func:`!fsync` function; on Windows, the MS :c:func:`!_commit` function.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-09-15 08:11:28 -03:00
|
|
|
If you're starting with a buffered Python :term:`file object` *f*, first do
|
|
|
|
``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all internal
|
|
|
|
buffers associated with *f* are written to disk.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: ftruncate(fd, length, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 07:55:33 -03:00
|
|
|
Truncate the file corresponding to file descriptor *fd*, so that it is at
|
2012-06-25 02:40:32 -03:00
|
|
|
most *length* bytes in size. As of Python 3.3, this is equivalent to
|
2012-06-24 07:55:33 -03:00
|
|
|
``os.truncate(fd, length)``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2019-06-27 14:47:59 -03:00
|
|
|
.. audit-event:: os.truncate fd,length os.ftruncate
|
2019-05-23 12:45:22 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-03-20 23:50:46 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
Added support for Windows
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-05-23 12:45:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: get_blocking(fd, /)
|
2014-07-29 17:32:47 -03:00
|
|
|
|
|
|
|
Get the blocking mode of the file descriptor: ``False`` if the
|
|
|
|
:data:`O_NONBLOCK` flag is set, ``True`` if the flag is cleared.
|
|
|
|
|
|
|
|
See also :func:`set_blocking` and :meth:`socket.socket.setblocking`.
|
|
|
|
|
2023-02-16 10:52:24 -04:00
|
|
|
.. availability:: Unix, Windows.
|
2014-07-29 17:32:47 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is limited on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
2023-02-16 10:52:24 -04:00
|
|
|
On Windows, this function is limited to pipes.
|
|
|
|
|
2014-07-29 17:32:47 -03:00
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2023-02-16 10:52:24 -04:00
|
|
|
.. versionchanged:: 3.12
|
|
|
|
Added support for pipes on Windows.
|
2019-05-23 12:45:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: isatty(fd, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return ``True`` if the file descriptor *fd* is open and connected to a
|
2010-05-06 20:03:05 -03:00
|
|
|
tty(-like) device, else ``False``.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: lockf(fd, cmd, len, /)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
Apply, test or remove a POSIX lock on an open file descriptor.
|
|
|
|
*fd* is an open file descriptor.
|
|
|
|
*cmd* specifies the command to use - one of :data:`F_LOCK`, :data:`F_TLOCK`,
|
|
|
|
:data:`F_ULOCK` or :data:`F_TEST`.
|
|
|
|
*len* specifies the section of the file to lock.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.lockf fd,cmd,len os.lockf
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: F_LOCK
|
|
|
|
F_TLOCK
|
|
|
|
F_ULOCK
|
|
|
|
F_TEST
|
|
|
|
|
|
|
|
Flags that specify what action :func:`lockf` will take.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2012-06-24 08:31:20 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: login_tty(fd, /)
|
2022-05-05 13:04:44 -03:00
|
|
|
|
|
|
|
Prepare the tty of which fd is a file descriptor for a new login session.
|
|
|
|
Make the calling process a session leader; make the tty the controlling tty,
|
|
|
|
the stdin, the stdout, and the stderr of the calling process; close fd.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2022-05-05 13:04:44 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.11
|
|
|
|
|
|
|
|
|
2023-08-18 14:53:51 -03:00
|
|
|
.. function:: lseek(fd, pos, whence, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
Set the current position of file descriptor *fd* to position *pos*, modified
|
2023-08-18 14:53:51 -03:00
|
|
|
by *whence*, and return the new position in bytes relative to
|
|
|
|
the start of the file.
|
|
|
|
Valid values for *whence* are:
|
|
|
|
|
|
|
|
* :const:`SEEK_SET` or ``0`` -- set *pos* relative to the beginning of the file
|
|
|
|
* :const:`SEEK_CUR` or ``1`` -- set *pos* relative to the current file position
|
|
|
|
* :const:`SEEK_END` or ``2`` -- set *pos* relative to the end of the file
|
|
|
|
* :const:`SEEK_HOLE` -- set *pos* to the next data location, relative to *pos*
|
|
|
|
* :const:`SEEK_DATA` -- set *pos* to the next data hole, relative to *pos*
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2023-08-17 11:14:01 -03:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
|
2023-08-18 14:53:51 -03:00
|
|
|
Add support for :const:`!SEEK_HOLE` and :const:`!SEEK_DATA`.
|
2023-08-17 11:14:01 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 80030,80067,80069,80080-80081,80084,80432-80433,80465-80470,81059,81065-81067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80030 | georg.brandl | 2010-04-13 08:43:54 +0200 (Di, 13 Apr 2010) | 1 line
Get rid of multi-row cells.
........
r80067 | georg.brandl | 2010-04-14 10:53:38 +0200 (Mi, 14 Apr 2010) | 1 line
#5341: typo.
........
r80069 | georg.brandl | 2010-04-14 15:50:31 +0200 (Mi, 14 Apr 2010) | 1 line
Add an x-ref to where the O_ constants are documented and move the SEEK_ constants after lseek().
........
r80080 | georg.brandl | 2010-04-14 21:16:38 +0200 (Mi, 14 Apr 2010) | 1 line
#8399: add note about Windows and O_BINARY.
........
r80081 | georg.brandl | 2010-04-14 23:34:44 +0200 (Mi, 14 Apr 2010) | 1 line
#5250: document __instancecheck__ and __subclasscheck__. I hope the part about the class/metaclass distinction is understandable.
........
r80084 | georg.brandl | 2010-04-14 23:46:45 +0200 (Mi, 14 Apr 2010) | 1 line
Fix missing.
........
r80432 | georg.brandl | 2010-04-24 10:56:58 +0200 (Sa, 24 Apr 2010) | 1 line
Markup fixes.
........
r80433 | georg.brandl | 2010-04-24 11:08:10 +0200 (Sa, 24 Apr 2010) | 1 line
#7507: quote "!" in pipes.quote(); it is a special character for some shells.
........
r80465 | georg.brandl | 2010-04-25 12:29:17 +0200 (So, 25 Apr 2010) | 1 line
Remove LaTeXy index entry syntax.
........
r80466 | georg.brandl | 2010-04-25 12:54:42 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Better cross-referencing in socket and winreg docs.
........
r80467 | georg.brandl | 2010-04-25 12:55:16 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Remove reference to winreg being the fabled high-level registry interface.
........
r80468 | georg.brandl | 2010-04-25 12:55:58 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Minor spelling changes to _winreg docs.
........
r80469 | georg.brandl | 2010-04-25 12:56:41 +0200 (So, 25 Apr 2010) | 1 line
Fix code example to have valid syntax so that it can be highlighted.
........
r80470 | georg.brandl | 2010-04-25 12:57:15 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Make socket setblocking <-> settimeout examples symmetric.
........
r81059 | georg.brandl | 2010-05-10 23:02:51 +0200 (Mo, 10 Mai 2010) | 1 line
#8642: fix wrong function name.
........
r81065 | georg.brandl | 2010-05-10 23:46:50 +0200 (Mo, 10 Mai 2010) | 1 line
Fix reference direction.
........
r81066 | georg.brandl | 2010-05-10 23:50:57 +0200 (Mo, 10 Mai 2010) | 1 line
Consolidate deprecation messages.
........
r81067 | georg.brandl | 2010-05-10 23:51:33 +0200 (Mo, 10 Mai 2010) | 1 line
Fix typo.
........
2010-05-19 17:57:08 -03:00
|
|
|
.. data:: SEEK_SET
|
|
|
|
SEEK_CUR
|
|
|
|
SEEK_END
|
|
|
|
|
2023-08-17 17:41:35 -03:00
|
|
|
Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek`
|
|
|
|
method on :term:`file-like objects <file object>`,
|
|
|
|
for whence to adjust the file position indicator.
|
|
|
|
|
|
|
|
:const:`SEEK_SET`
|
|
|
|
Adjust the file position relative to the beginning of the file.
|
|
|
|
:const:`SEEK_CUR`
|
|
|
|
Adjust the file position relative to the current file position.
|
|
|
|
:const:`SEEK_END`
|
|
|
|
Adjust the file position relative to the end of the file.
|
|
|
|
|
|
|
|
Their values are 0, 1, and 2, respectively.
|
2012-06-24 08:29:09 -03:00
|
|
|
|
2023-08-17 11:14:01 -03:00
|
|
|
|
|
|
|
.. data:: SEEK_HOLE
|
|
|
|
SEEK_DATA
|
|
|
|
|
|
|
|
Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek`
|
2023-08-17 17:41:35 -03:00
|
|
|
method on :term:`file-like objects <file object>`,
|
|
|
|
for seeking file data and holes on sparsely allocated files.
|
2023-08-17 11:14:01 -03:00
|
|
|
|
|
|
|
:data:`!SEEK_DATA`
|
|
|
|
Adjust the file offset to the next location containing data,
|
|
|
|
relative to the seek position.
|
|
|
|
|
|
|
|
:data:`!SEEK_HOLE`
|
|
|
|
Adjust the file offset to the next location containing a hole,
|
|
|
|
relative to the seek position.
|
|
|
|
A hole is defined as a sequence of zeros.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
These operations only make sense for filesystems that support them.
|
|
|
|
|
|
|
|
.. availability:: Linux >= 3.1, macOS, Unix
|
|
|
|
|
2012-06-22 13:32:07 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
Merged revisions 80030,80067,80069,80080-80081,80084,80432-80433,80465-80470,81059,81065-81067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80030 | georg.brandl | 2010-04-13 08:43:54 +0200 (Di, 13 Apr 2010) | 1 line
Get rid of multi-row cells.
........
r80067 | georg.brandl | 2010-04-14 10:53:38 +0200 (Mi, 14 Apr 2010) | 1 line
#5341: typo.
........
r80069 | georg.brandl | 2010-04-14 15:50:31 +0200 (Mi, 14 Apr 2010) | 1 line
Add an x-ref to where the O_ constants are documented and move the SEEK_ constants after lseek().
........
r80080 | georg.brandl | 2010-04-14 21:16:38 +0200 (Mi, 14 Apr 2010) | 1 line
#8399: add note about Windows and O_BINARY.
........
r80081 | georg.brandl | 2010-04-14 23:34:44 +0200 (Mi, 14 Apr 2010) | 1 line
#5250: document __instancecheck__ and __subclasscheck__. I hope the part about the class/metaclass distinction is understandable.
........
r80084 | georg.brandl | 2010-04-14 23:46:45 +0200 (Mi, 14 Apr 2010) | 1 line
Fix missing.
........
r80432 | georg.brandl | 2010-04-24 10:56:58 +0200 (Sa, 24 Apr 2010) | 1 line
Markup fixes.
........
r80433 | georg.brandl | 2010-04-24 11:08:10 +0200 (Sa, 24 Apr 2010) | 1 line
#7507: quote "!" in pipes.quote(); it is a special character for some shells.
........
r80465 | georg.brandl | 2010-04-25 12:29:17 +0200 (So, 25 Apr 2010) | 1 line
Remove LaTeXy index entry syntax.
........
r80466 | georg.brandl | 2010-04-25 12:54:42 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Better cross-referencing in socket and winreg docs.
........
r80467 | georg.brandl | 2010-04-25 12:55:16 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Remove reference to winreg being the fabled high-level registry interface.
........
r80468 | georg.brandl | 2010-04-25 12:55:58 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Minor spelling changes to _winreg docs.
........
r80469 | georg.brandl | 2010-04-25 12:56:41 +0200 (So, 25 Apr 2010) | 1 line
Fix code example to have valid syntax so that it can be highlighted.
........
r80470 | georg.brandl | 2010-04-25 12:57:15 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Make socket setblocking <-> settimeout examples symmetric.
........
r81059 | georg.brandl | 2010-05-10 23:02:51 +0200 (Mo, 10 Mai 2010) | 1 line
#8642: fix wrong function name.
........
r81065 | georg.brandl | 2010-05-10 23:46:50 +0200 (Mo, 10 Mai 2010) | 1 line
Fix reference direction.
........
r81066 | georg.brandl | 2010-05-10 23:50:57 +0200 (Mo, 10 Mai 2010) | 1 line
Consolidate deprecation messages.
........
r81067 | georg.brandl | 2010-05-10 23:51:33 +0200 (Mo, 10 Mai 2010) | 1 line
Fix typo.
........
2010-05-19 17:57:08 -03:00
|
|
|
|
2015-09-08 22:01:13 -03:00
|
|
|
.. function:: open(path, flags, mode=0o777, *, dir_fd=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-09-08 22:01:13 -03:00
|
|
|
Open the file *path* and set various flags according to *flags* and possibly
|
2012-06-22 20:30:09 -03:00
|
|
|
its mode according to *mode*. When computing *mode*, the current umask value
|
|
|
|
is first masked out. Return the file descriptor for the newly opened file.
|
2013-08-27 19:53:59 -03:00
|
|
|
The new file descriptor is :ref:`non-inheritable <fd_inheritance>`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
For a description of the flag and mode values, see the C run-time documentation;
|
|
|
|
flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) are defined in
|
2013-06-21 12:49:57 -03:00
|
|
|
the :mod:`os` module. In particular, on Windows adding
|
Merged revisions 80030,80067,80069,80080-80081,80084,80432-80433,80465-80470,81059,81065-81067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80030 | georg.brandl | 2010-04-13 08:43:54 +0200 (Di, 13 Apr 2010) | 1 line
Get rid of multi-row cells.
........
r80067 | georg.brandl | 2010-04-14 10:53:38 +0200 (Mi, 14 Apr 2010) | 1 line
#5341: typo.
........
r80069 | georg.brandl | 2010-04-14 15:50:31 +0200 (Mi, 14 Apr 2010) | 1 line
Add an x-ref to where the O_ constants are documented and move the SEEK_ constants after lseek().
........
r80080 | georg.brandl | 2010-04-14 21:16:38 +0200 (Mi, 14 Apr 2010) | 1 line
#8399: add note about Windows and O_BINARY.
........
r80081 | georg.brandl | 2010-04-14 23:34:44 +0200 (Mi, 14 Apr 2010) | 1 line
#5250: document __instancecheck__ and __subclasscheck__. I hope the part about the class/metaclass distinction is understandable.
........
r80084 | georg.brandl | 2010-04-14 23:46:45 +0200 (Mi, 14 Apr 2010) | 1 line
Fix missing.
........
r80432 | georg.brandl | 2010-04-24 10:56:58 +0200 (Sa, 24 Apr 2010) | 1 line
Markup fixes.
........
r80433 | georg.brandl | 2010-04-24 11:08:10 +0200 (Sa, 24 Apr 2010) | 1 line
#7507: quote "!" in pipes.quote(); it is a special character for some shells.
........
r80465 | georg.brandl | 2010-04-25 12:29:17 +0200 (So, 25 Apr 2010) | 1 line
Remove LaTeXy index entry syntax.
........
r80466 | georg.brandl | 2010-04-25 12:54:42 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Better cross-referencing in socket and winreg docs.
........
r80467 | georg.brandl | 2010-04-25 12:55:16 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Remove reference to winreg being the fabled high-level registry interface.
........
r80468 | georg.brandl | 2010-04-25 12:55:58 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Minor spelling changes to _winreg docs.
........
r80469 | georg.brandl | 2010-04-25 12:56:41 +0200 (So, 25 Apr 2010) | 1 line
Fix code example to have valid syntax so that it can be highlighted.
........
r80470 | georg.brandl | 2010-04-25 12:57:15 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Make socket setblocking <-> settimeout examples symmetric.
........
r81059 | georg.brandl | 2010-05-10 23:02:51 +0200 (Mo, 10 Mai 2010) | 1 line
#8642: fix wrong function name.
........
r81065 | georg.brandl | 2010-05-10 23:46:50 +0200 (Mo, 10 Mai 2010) | 1 line
Fix reference direction.
........
r81066 | georg.brandl | 2010-05-10 23:50:57 +0200 (Mo, 10 Mai 2010) | 1 line
Consolidate deprecation messages.
........
r81067 | georg.brandl | 2010-05-10 23:51:33 +0200 (Mo, 10 Mai 2010) | 1 line
Fix typo.
........
2010-05-19 17:57:08 -03:00
|
|
|
:const:`O_BINARY` is needed to open files in binary mode.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support :ref:`paths relative to directory descriptors
|
2013-06-21 12:49:57 -03:00
|
|
|
<dir_fd>` with the *dir_fd* parameter.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2019-06-27 14:47:59 -03:00
|
|
|
.. audit-event:: open path,mode,flags os.open
|
2019-05-23 12:45:22 -03:00
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
.. versionchanged:: 3.4
|
|
|
|
The new file descriptor is now non-inheritable.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. note::
|
|
|
|
|
2009-07-26 12:02:41 -03:00
|
|
|
This function is intended for low-level I/O. For normal usage, use the
|
2010-09-15 08:11:28 -03:00
|
|
|
built-in function :func:`open`, which returns a :term:`file object` with
|
2010-07-13 11:47:01 -03:00
|
|
|
:meth:`~file.read` and :meth:`~file.write` methods (and many more). To
|
2010-09-15 08:11:28 -03:00
|
|
|
wrap a file descriptor in a file object, use :func:`fdopen`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-02-25 19:25:17 -04:00
|
|
|
.. versionadded:: 3.3
|
2012-06-22 20:30:09 -03:00
|
|
|
The *dir_fd* argument.
|
2011-02-25 19:25:17 -04:00
|
|
|
|
2015-03-26 19:50:57 -03:00
|
|
|
.. versionchanged:: 3.5
|
2015-04-02 06:49:42 -03:00
|
|
|
If the system call is interrupted and the signal handler does not raise an
|
2015-03-26 19:50:57 -03:00
|
|
|
exception, the function now retries the system call instead of raising an
|
|
|
|
:exc:`InterruptedError` exception (see :pep:`475` for the rationale).
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2013-06-21 12:49:57 -03:00
|
|
|
The following constants are options for the *flags* parameter to the
|
|
|
|
:func:`~os.open` function. They can be combined using the bitwise OR operator
|
|
|
|
``|``. Some of them are not available on all platforms. For descriptions of
|
|
|
|
their availability and use, consult the :manpage:`open(2)` manual page on Unix
|
2016-02-26 14:37:12 -04:00
|
|
|
or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windows.
|
2013-06-21 12:49:57 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: O_RDONLY
|
|
|
|
O_WRONLY
|
|
|
|
O_RDWR
|
|
|
|
O_APPEND
|
|
|
|
O_CREAT
|
|
|
|
O_EXCL
|
|
|
|
O_TRUNC
|
|
|
|
|
2016-09-11 11:15:59 -03:00
|
|
|
The above constants are available on Unix and Windows.
|
2013-06-21 12:49:57 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: O_DSYNC
|
|
|
|
O_RSYNC
|
|
|
|
O_SYNC
|
|
|
|
O_NDELAY
|
|
|
|
O_NONBLOCK
|
|
|
|
O_NOCTTY
|
|
|
|
O_CLOEXEC
|
|
|
|
|
2016-09-11 11:15:59 -03:00
|
|
|
The above constants are only available on Unix.
|
2013-06-21 12:49:57 -03:00
|
|
|
|
|
|
|
.. versionchanged:: 3.3
|
|
|
|
Add :data:`O_CLOEXEC` constant.
|
|
|
|
|
|
|
|
.. data:: O_BINARY
|
|
|
|
O_NOINHERIT
|
|
|
|
O_SHORT_LIVED
|
|
|
|
O_TEMPORARY
|
|
|
|
O_RANDOM
|
|
|
|
O_SEQUENTIAL
|
|
|
|
O_TEXT
|
|
|
|
|
2016-09-11 11:15:59 -03:00
|
|
|
The above constants are only available on Windows.
|
2013-06-21 12:49:57 -03:00
|
|
|
|
2021-02-03 19:32:55 -04:00
|
|
|
.. data:: O_EVTONLY
|
|
|
|
O_FSYNC
|
|
|
|
O_SYMLINK
|
|
|
|
O_NOFOLLOW_ANY
|
|
|
|
|
|
|
|
The above constants are only available on macOS.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.10
|
|
|
|
Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK`
|
|
|
|
and :data:`O_NOFOLLOW_ANY` constants.
|
2013-06-21 12:49:57 -03:00
|
|
|
|
|
|
|
.. data:: O_ASYNC
|
|
|
|
O_DIRECT
|
|
|
|
O_DIRECTORY
|
|
|
|
O_NOFOLLOW
|
|
|
|
O_NOATIME
|
|
|
|
O_PATH
|
2013-08-16 09:35:09 -03:00
|
|
|
O_TMPFILE
|
2016-09-11 11:15:59 -03:00
|
|
|
O_SHLOCK
|
|
|
|
O_EXLOCK
|
2013-06-21 12:49:57 -03:00
|
|
|
|
2016-09-11 11:15:59 -03:00
|
|
|
The above constants are extensions and not present if they are not defined by
|
2013-06-21 12:49:57 -03:00
|
|
|
the C library.
|
|
|
|
|
2013-08-16 09:37:50 -03:00
|
|
|
.. versionchanged:: 3.4
|
2014-03-16 01:13:56 -03:00
|
|
|
Add :data:`O_PATH` on systems that support it.
|
|
|
|
Add :data:`O_TMPFILE`, only available on Linux Kernel 3.11
|
|
|
|
or newer.
|
2013-08-16 09:37:50 -03:00
|
|
|
|
2011-02-25 19:25:17 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: openpty()
|
|
|
|
|
2023-05-04 05:17:12 -03:00
|
|
|
.. index:: pair: module; pty
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
Open a new pseudo-terminal pair. Return a pair of file descriptors
|
|
|
|
``(master, slave)`` for the pty and the tty, respectively. The new file
|
|
|
|
descriptors are :ref:`non-inheritable <fd_inheritance>`. For a (slightly) more
|
|
|
|
portable approach, use the :mod:`pty` module.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
.. versionchanged:: 3.4
|
|
|
|
The new file descriptors are now non-inheritable.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: pipe()
|
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for
|
2013-11-05 20:48:45 -04:00
|
|
|
reading and writing, respectively. The new file descriptor is
|
2013-08-27 19:53:59 -03:00
|
|
|
:ref:`non-inheritable <fd_inheritance>`.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
.. versionchanged:: 3.4
|
|
|
|
The new file descriptors are now non-inheritable.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: pipe2(flags, /)
|
2011-05-29 15:07:40 -03:00
|
|
|
|
|
|
|
Create a pipe with *flags* set atomically.
|
2011-06-06 14:49:47 -03:00
|
|
|
*flags* can be constructed by ORing together one or more of these values:
|
|
|
|
:data:`O_NONBLOCK`, :data:`O_CLOEXEC`.
|
2011-05-29 15:07:40 -03:00
|
|
|
Return a pair of file descriptors ``(r, w)`` usable for reading and writing,
|
|
|
|
respectively.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2011-05-29 15:07:40 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: posix_fallocate(fd, offset, len, /)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
Ensures that enough disk space is allocated for the file specified by *fd*
|
|
|
|
starting from *offset* and continuing for *len* bytes.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: posix_fadvise(fd, offset, len, advice, /)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
Announces an intention to access data in a specific pattern thus allowing
|
|
|
|
the kernel to make optimizations.
|
|
|
|
The advice applies to the region of the file specified by *fd* starting at
|
|
|
|
*offset* and continuing for *len* bytes.
|
|
|
|
*advice* is one of :data:`POSIX_FADV_NORMAL`, :data:`POSIX_FADV_SEQUENTIAL`,
|
|
|
|
:data:`POSIX_FADV_RANDOM`, :data:`POSIX_FADV_NOREUSE`,
|
|
|
|
:data:`POSIX_FADV_WILLNEED` or :data:`POSIX_FADV_DONTNEED`.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: POSIX_FADV_NORMAL
|
|
|
|
POSIX_FADV_SEQUENTIAL
|
|
|
|
POSIX_FADV_RANDOM
|
|
|
|
POSIX_FADV_NOREUSE
|
|
|
|
POSIX_FADV_WILLNEED
|
|
|
|
POSIX_FADV_DONTNEED
|
|
|
|
|
|
|
|
Flags that can be used in *advice* in :func:`posix_fadvise` that specify
|
|
|
|
the access pattern that is likely to be used.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: pread(fd, n, offset, /)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
Read at most *n* bytes from file descriptor *fd* at a position of *offset*,
|
|
|
|
leaving the file offset unchanged.
|
|
|
|
|
|
|
|
Return a bytestring containing the bytes read. If the end of the file
|
|
|
|
referred to by *fd* has been reached, an empty bytes object is returned.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: preadv(fd, buffers, offset, flags=0, /)
|
2018-05-30 20:00:04 -03:00
|
|
|
|
|
|
|
Read from a file descriptor *fd* at a position of *offset* into mutable
|
|
|
|
:term:`bytes-like objects <bytes-like object>` *buffers*, leaving the file
|
|
|
|
offset unchanged. Transfer data into each buffer until it is full and then
|
|
|
|
move on to the next buffer in the sequence to hold the rest of the data.
|
|
|
|
|
|
|
|
The flags argument contains a bitwise OR of zero or more of the following
|
|
|
|
flags:
|
|
|
|
|
|
|
|
- :data:`RWF_HIPRI`
|
|
|
|
- :data:`RWF_NOWAIT`
|
|
|
|
|
|
|
|
Return the total number of bytes actually read which can be less than the
|
|
|
|
total capacity of all the objects.
|
|
|
|
|
|
|
|
The operating system may set a limit (:func:`sysconf` value
|
|
|
|
``'SC_IOV_MAX'``) on the number of buffers that can be used.
|
|
|
|
|
|
|
|
Combine the functionality of :func:`os.readv` and :func:`os.pread`.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD >= 2.7, AIX >= 7.1.
|
|
|
|
|
|
|
|
Using flags requires Linux >= 4.6.
|
2018-05-30 20:00:04 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.7
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: RWF_NOWAIT
|
|
|
|
|
|
|
|
Do not wait for data which is not immediately available. If this flag is
|
|
|
|
specified, the system call will return instantly if it would have to read
|
|
|
|
data from the backing storage or wait for a lock.
|
|
|
|
|
|
|
|
If some data was successfully read, it will return the number of bytes read.
|
|
|
|
If no bytes were read, it will return ``-1`` and set errno to
|
2023-07-21 06:40:37 -03:00
|
|
|
:const:`errno.EAGAIN`.
|
2018-05-30 20:00:04 -03:00
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 4.14.
|
2018-05-30 20:00:04 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.7
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: RWF_HIPRI
|
|
|
|
|
|
|
|
High priority read/write. Allows block-based filesystems to use polling
|
|
|
|
of the device, which provides lower latency, but may use additional
|
|
|
|
resources.
|
|
|
|
|
|
|
|
Currently, on Linux, this feature is usable only on a file descriptor opened
|
|
|
|
using the :data:`O_DIRECT` flag.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 4.6.
|
2018-05-30 20:00:04 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.7
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: pwrite(fd, str, offset, /)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
Write the bytestring in *str* to file descriptor *fd* at position of
|
|
|
|
*offset*, leaving the file offset unchanged.
|
|
|
|
|
|
|
|
Return the number of bytes actually written.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: pwritev(fd, buffers, offset, flags=0, /)
|
2018-01-27 12:16:37 -04:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
Write the *buffers* contents to file descriptor *fd* at a offset *offset*,
|
|
|
|
leaving the file offset unchanged. *buffers* must be a sequence of
|
|
|
|
:term:`bytes-like objects <bytes-like object>`. Buffers are processed in
|
|
|
|
array order. Entire contents of the first buffer is written before
|
|
|
|
proceeding to the second, and so on.
|
2018-01-27 12:16:37 -04:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
The flags argument contains a bitwise OR of zero or more of the following
|
2018-01-27 12:16:37 -04:00
|
|
|
flags:
|
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
- :data:`RWF_DSYNC`
|
|
|
|
- :data:`RWF_SYNC`
|
2020-05-27 18:32:22 -03:00
|
|
|
- :data:`RWF_APPEND`
|
2018-01-27 12:16:37 -04:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
Return the total number of bytes actually written.
|
2018-01-27 12:16:37 -04:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
The operating system may set a limit (:func:`sysconf` value
|
|
|
|
``'SC_IOV_MAX'``) on the number of buffers that can be used.
|
|
|
|
|
|
|
|
Combine the functionality of :func:`os.writev` and :func:`os.pwrite`.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD >= 2.7, AIX >= 7.1.
|
|
|
|
|
|
|
|
Using flags requires Linux >= 4.6.
|
2018-01-27 12:16:37 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.7
|
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
|
2018-04-25 14:48:27 -03:00
|
|
|
.. data:: RWF_DSYNC
|
|
|
|
|
2020-05-27 18:32:22 -03:00
|
|
|
Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag.
|
|
|
|
This flag effect applies only to the data range written by the system call.
|
2018-01-27 12:16:37 -04:00
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 4.7.
|
2018-04-25 14:48:27 -03:00
|
|
|
|
2018-01-27 12:16:37 -04:00
|
|
|
.. versionadded:: 3.7
|
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
|
2018-04-25 14:48:27 -03:00
|
|
|
.. data:: RWF_SYNC
|
|
|
|
|
2020-05-27 18:32:22 -03:00
|
|
|
Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag.
|
|
|
|
This flag effect applies only to the data range written by the system call.
|
2018-01-27 12:16:37 -04:00
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 4.7.
|
2018-04-25 14:48:27 -03:00
|
|
|
|
2018-01-27 12:16:37 -04:00
|
|
|
.. versionadded:: 3.7
|
|
|
|
|
|
|
|
|
2020-05-27 18:32:22 -03:00
|
|
|
.. data:: RWF_APPEND
|
|
|
|
|
2020-12-17 13:25:55 -04:00
|
|
|
Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open`
|
|
|
|
flag. This flag is meaningful only for :func:`os.pwritev`, and its
|
|
|
|
effect applies only to the data range written by the system call. The
|
|
|
|
*offset* argument does not affect the write operation; the data is always
|
|
|
|
appended to the end of the file. However, if the *offset* argument is
|
|
|
|
``-1``, the current file *offset* is updated.
|
2020-05-27 18:32:22 -03:00
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 4.16.
|
2020-05-27 18:32:22 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: read(fd, n, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
Read at most *n* bytes from file descriptor *fd*.
|
|
|
|
|
|
|
|
Return a bytestring containing the bytes read. If the end of the file
|
|
|
|
referred to by *fd* has been reached, an empty bytes object is returned.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
This function is intended for low-level I/O and must be applied to a file
|
2012-06-24 08:24:56 -03:00
|
|
|
descriptor as returned by :func:`os.open` or :func:`pipe`. To read a
|
|
|
|
"file object" returned by the built-in function :func:`open` or by
|
|
|
|
:func:`popen` or :func:`fdopen`, or :data:`sys.stdin`, use its
|
|
|
|
:meth:`~file.read` or :meth:`~file.readline` methods.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-03-26 19:50:57 -03:00
|
|
|
.. versionchanged:: 3.5
|
2015-04-02 06:49:42 -03:00
|
|
|
If the system call is interrupted and the signal handler does not raise an
|
2015-03-26 19:50:57 -03:00
|
|
|
exception, the function now retries the system call instead of raising an
|
|
|
|
:exc:`InterruptedError` exception (see :pep:`475` for the rationale).
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-10-13 05:59:31 -03:00
|
|
|
.. function:: sendfile(out_fd, in_fd, offset, count)
|
2020-04-18 13:14:10 -03:00
|
|
|
sendfile(out_fd, in_fd, offset, count, headers=(), trailers=(), flags=0)
|
2011-02-25 10:39:16 -04:00
|
|
|
|
2019-10-13 05:59:31 -03:00
|
|
|
Copy *count* bytes from file descriptor *in_fd* to file descriptor *out_fd*
|
2011-02-25 10:39:16 -04:00
|
|
|
starting at *offset*.
|
2019-10-13 05:59:31 -03:00
|
|
|
Return the number of bytes sent. When EOF is reached return ``0``.
|
2011-02-25 10:39:16 -04:00
|
|
|
|
|
|
|
The first function notation is supported by all platforms that define
|
|
|
|
:func:`sendfile`.
|
|
|
|
|
|
|
|
On Linux, if *offset* is given as ``None``, the bytes are read from the
|
2019-10-13 05:59:31 -03:00
|
|
|
current position of *in_fd* and the position of *in_fd* is updated.
|
2011-02-25 10:39:16 -04:00
|
|
|
|
2021-07-26 16:37:31 -03:00
|
|
|
The second case may be used on macOS and FreeBSD where *headers* and
|
2011-02-25 10:39:16 -04:00
|
|
|
*trailers* are arbitrary sequences of buffers that are written before and
|
2019-10-13 05:59:31 -03:00
|
|
|
after the data from *in_fd* is written. It returns the same as the first case.
|
2011-02-25 10:39:16 -04:00
|
|
|
|
2021-07-26 16:37:31 -03:00
|
|
|
On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until
|
2019-10-13 05:59:31 -03:00
|
|
|
the end of *in_fd* is reached.
|
2011-02-25 10:39:16 -04:00
|
|
|
|
2019-10-13 05:59:31 -03:00
|
|
|
All platforms support sockets as *out_fd* file descriptor, and some platforms
|
2013-05-01 10:12:20 -03:00
|
|
|
allow other types (e.g. regular file, pipe) as well.
|
2011-02-25 10:39:16 -04:00
|
|
|
|
2014-04-24 13:09:21 -03:00
|
|
|
Cross-platform applications should not use *headers*, *trailers* and *flags*
|
|
|
|
arguments.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2011-02-25 10:39:16 -04:00
|
|
|
|
2014-06-10 22:54:30 -03:00
|
|
|
.. note::
|
|
|
|
|
2014-06-15 22:30:27 -03:00
|
|
|
For a higher-level wrapper of :func:`sendfile`, see
|
2015-09-11 20:44:18 -03:00
|
|
|
:meth:`socket.socket.sendfile`.
|
2014-06-10 22:54:30 -03:00
|
|
|
|
2011-02-25 10:39:16 -04:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2019-10-13 05:59:31 -03:00
|
|
|
.. versionchanged:: 3.9
|
|
|
|
Parameters *out* and *in* was renamed to *out_fd* and *in_fd*.
|
|
|
|
|
2011-02-25 10:39:16 -04:00
|
|
|
|
|
|
|
.. data:: SF_NODISKIO
|
|
|
|
SF_MNOWAIT
|
|
|
|
SF_SYNC
|
|
|
|
|
|
|
|
Parameters to the :func:`sendfile` function, if the implementation supports
|
|
|
|
them.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2011-02-25 10:39:16 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2022-01-03 09:01:04 -04:00
|
|
|
.. data:: SF_NOCACHE
|
|
|
|
|
|
|
|
Parameter to the :func:`sendfile` function, if the implementation supports
|
|
|
|
it. The data won't be cached in the virtual memory and will be freed afterwards.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2022-01-03 09:01:04 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.11
|
|
|
|
|
2011-02-25 10:39:16 -04:00
|
|
|
|
2023-09-07 12:50:10 -03:00
|
|
|
.. function:: set_blocking(fd, blocking, /)
|
|
|
|
|
|
|
|
Set the blocking mode of the specified file descriptor. Set the
|
|
|
|
:data:`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise.
|
|
|
|
|
|
|
|
See also :func:`get_blocking` and :meth:`socket.socket.setblocking`.
|
|
|
|
|
|
|
|
.. availability:: Unix, Windows.
|
|
|
|
|
|
|
|
The function is limited on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
|
|
|
On Windows, this function is limited to pipes.
|
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
.. versionchanged:: 3.12
|
|
|
|
Added support for pipes on Windows.
|
|
|
|
|
|
|
|
|
2020-11-16 20:00:38 -04:00
|
|
|
.. function:: splice(src, dst, count, offset_src=None, offset_dst=None)
|
|
|
|
|
|
|
|
Transfer *count* bytes from file descriptor *src*, starting from offset
|
|
|
|
*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*.
|
|
|
|
At least one of the file descriptors must refer to a pipe. If *offset_src*
|
|
|
|
is None, then *src* is read from the current position; respectively for
|
|
|
|
*offset_dst*. The offset associated to the file descriptor that refers to a
|
|
|
|
pipe must be ``None``. The files pointed by *src* and *dst* must reside in
|
|
|
|
the same filesystem, otherwise an :exc:`OSError` is raised with
|
2023-07-21 06:40:37 -03:00
|
|
|
:attr:`~OSError.errno` set to :const:`errno.EXDEV`.
|
2020-11-16 20:00:38 -04:00
|
|
|
|
|
|
|
This copy is done without the additional cost of transferring data
|
|
|
|
from the kernel to user space and then back into the kernel. Additionally,
|
|
|
|
some filesystems could implement extra optimizations. The copy is done as if
|
|
|
|
both files are opened as binary.
|
|
|
|
|
|
|
|
Upon successful completion, returns the number of bytes spliced to or from
|
|
|
|
the pipe. A return value of 0 means end of input. If *src* refers to a
|
|
|
|
pipe, then this means that there was no data to transfer, and it would not
|
|
|
|
make sense to block because there are no writers connected to the write end
|
|
|
|
of the pipe.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 2.6.17 with glibc >= 2.5
|
2020-11-16 20:00:38 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: SPLICE_F_MOVE
|
|
|
|
SPLICE_F_NONBLOCK
|
|
|
|
SPLICE_F_MORE
|
|
|
|
|
2020-11-17 14:13:50 -04:00
|
|
|
.. versionadded:: 3.10
|
2020-11-16 20:00:38 -04:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: readv(fd, buffers, /)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2014-01-18 23:54:59 -04:00
|
|
|
Read from a file descriptor *fd* into a number of mutable :term:`bytes-like
|
2018-05-30 20:00:04 -03:00
|
|
|
objects <bytes-like object>` *buffers*. Transfer data into each buffer until
|
|
|
|
it is full and then move on to the next buffer in the sequence to hold the
|
|
|
|
rest of the data.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
Return the total number of bytes actually read which can be less than the
|
|
|
|
total capacity of all the objects.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
The operating system may set a limit (:func:`sysconf` value
|
|
|
|
``'SC_IOV_MAX'``) on the number of buffers that can be used.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2018-04-25 14:48:27 -03:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
.. versionadded:: 3.3
|
2018-01-27 12:16:37 -04:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: tcgetpgrp(fd, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return the process group associated with the terminal given by *fd* (an open
|
2010-05-06 20:03:05 -03:00
|
|
|
file descriptor as returned by :func:`os.open`).
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: tcsetpgrp(fd, pg, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Set the process group associated with the terminal given by *fd* (an open file
|
2010-05-06 20:03:05 -03:00
|
|
|
descriptor as returned by :func:`os.open`) to *pg*.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: ttyname(fd, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return a string which specifies the terminal device associated with
|
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
|
|
|
file descriptor *fd*. If *fd* is not associated with a terminal device, an
|
2010-05-06 20:03:05 -03:00
|
|
|
exception is raised.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: write(fd, str, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
Write the bytestring in *str* to file descriptor *fd*.
|
|
|
|
|
|
|
|
Return the number of bytes actually written.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
This function is intended for low-level I/O and must be applied to a file
|
Merged revisions 72506,72525-72526,72551,72558,72616,72654-72655,72689,72745,72750,72802,72812,72822,72824,72826-72827,72833,72876,72890,72923,72946,73026,73042,73045,73047,73065,73068-73069 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72506 | vinay.sajip | 2009-05-09 07:07:17 -0500 (Sat, 09 May 2009) | 1 line
Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when trying to print a traceback.
........
r72525 | benjamin.peterson | 2009-05-09 20:38:02 -0500 (Sat, 09 May 2009) | 1 line
close file explicitly
........
r72526 | benjamin.peterson | 2009-05-09 21:29:00 -0500 (Sat, 09 May 2009) | 1 line
make sure files are closed using the with statement
........
r72551 | benjamin.peterson | 2009-05-10 09:16:47 -0500 (Sun, 10 May 2009) | 1 line
use isinstance
........
r72558 | benjamin.peterson | 2009-05-10 18:52:09 -0500 (Sun, 10 May 2009) | 1 line
sys.setdefaultencoding() strikes me as a bad example
........
r72616 | benjamin.peterson | 2009-05-13 19:33:10 -0500 (Wed, 13 May 2009) | 1 line
importlib.import_module is better these days
........
r72654 | benjamin.peterson | 2009-05-14 17:37:49 -0500 (Thu, 14 May 2009) | 1 line
prevent refleaks from threads
........
r72655 | benjamin.peterson | 2009-05-14 17:40:34 -0500 (Thu, 14 May 2009) | 1 line
a useful decorator for cleaning up threads
........
r72689 | benjamin.peterson | 2009-05-16 13:44:34 -0500 (Sat, 16 May 2009) | 1 line
use skipTest()
........
r72745 | benjamin.peterson | 2009-05-17 09:16:29 -0500 (Sun, 17 May 2009) | 1 line
ignore .rst files in sphinx its self
........
r72750 | benjamin.peterson | 2009-05-17 11:59:27 -0500 (Sun, 17 May 2009) | 1 line
chop off slash
........
r72802 | georg.brandl | 2009-05-20 13:35:27 -0500 (Wed, 20 May 2009) | 1 line
#6051: refer to email examples for better way to construct email messages.
........
r72812 | michael.foord | 2009-05-21 17:57:02 -0500 (Thu, 21 May 2009) | 1 line
Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in TestCase subclasses. Issue 6072.
........
r72822 | georg.brandl | 2009-05-22 04:33:25 -0500 (Fri, 22 May 2009) | 1 line
#6084: fix example.
........
r72824 | georg.brandl | 2009-05-22 04:43:17 -0500 (Fri, 22 May 2009) | 1 line
Fix references to file-related functions and methods (os.* vs file.*).
........
r72826 | georg.brandl | 2009-05-22 04:49:42 -0500 (Fri, 22 May 2009) | 1 line
Fix confusing wording.
........
r72827 | georg.brandl | 2009-05-22 04:50:30 -0500 (Fri, 22 May 2009) | 1 line
s/use/call/
........
r72833 | georg.brandl | 2009-05-22 12:00:17 -0500 (Fri, 22 May 2009) | 1 line
#6078: _warnings is a builtin module and has no standard init_warnings function.
........
r72876 | benjamin.peterson | 2009-05-23 15:59:09 -0500 (Sat, 23 May 2009) | 1 line
remove mention of old ctypes version
........
r72890 | gregory.p.smith | 2009-05-24 13:00:13 -0500 (Sun, 24 May 2009) | 2 lines
add a versionadded tag for set_tunnel
........
r72923 | michael.foord | 2009-05-25 15:36:56 -0500 (Mon, 25 May 2009) | 1 line
Make assertSequenceEqual error messages less cryptic, particularly for nested sequences.
........
r72946 | ronald.oussoren | 2009-05-26 13:44:48 -0500 (Tue, 26 May 2009) | 2 lines
Fixes issue 6110
........
r73026 | r.david.murray | 2009-05-29 14:30:27 -0500 (Fri, 29 May 2009) | 3 lines
Issue 6141: document that the first item of args is still the
command name even when executable is specified.
........
r73042 | benjamin.peterson | 2009-05-29 22:10:52 -0500 (Fri, 29 May 2009) | 1 line
no fdatasync on macos
........
r73045 | georg.brandl | 2009-05-30 02:26:04 -0500 (Sat, 30 May 2009) | 1 line
#6146: fix markup bug.
........
r73047 | georg.brandl | 2009-05-30 05:33:23 -0500 (Sat, 30 May 2009) | 1 line
Fix some more small markup problems.
........
r73065 | antoine.pitrou | 2009-05-30 16:39:25 -0500 (Sat, 30 May 2009) | 3 lines
The test for #5330 wasn't correct.
........
r73068 | antoine.pitrou | 2009-05-30 16:45:40 -0500 (Sat, 30 May 2009) | 3 lines
Update ACKS
........
r73069 | benjamin.peterson | 2009-05-30 19:42:42 -0500 (Sat, 30 May 2009) | 1 line
fix signature
........
2009-06-01 19:42:33 -03:00
|
|
|
descriptor as returned by :func:`os.open` or :func:`pipe`. To write a "file
|
2007-08-15 11:28:22 -03:00
|
|
|
object" returned by the built-in function :func:`open` or by :func:`popen` or
|
Merged revisions 72506,72525-72526,72551,72558,72616,72654-72655,72689,72745,72750,72802,72812,72822,72824,72826-72827,72833,72876,72890,72923,72946,73026,73042,73045,73047,73065,73068-73069 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72506 | vinay.sajip | 2009-05-09 07:07:17 -0500 (Sat, 09 May 2009) | 1 line
Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when trying to print a traceback.
........
r72525 | benjamin.peterson | 2009-05-09 20:38:02 -0500 (Sat, 09 May 2009) | 1 line
close file explicitly
........
r72526 | benjamin.peterson | 2009-05-09 21:29:00 -0500 (Sat, 09 May 2009) | 1 line
make sure files are closed using the with statement
........
r72551 | benjamin.peterson | 2009-05-10 09:16:47 -0500 (Sun, 10 May 2009) | 1 line
use isinstance
........
r72558 | benjamin.peterson | 2009-05-10 18:52:09 -0500 (Sun, 10 May 2009) | 1 line
sys.setdefaultencoding() strikes me as a bad example
........
r72616 | benjamin.peterson | 2009-05-13 19:33:10 -0500 (Wed, 13 May 2009) | 1 line
importlib.import_module is better these days
........
r72654 | benjamin.peterson | 2009-05-14 17:37:49 -0500 (Thu, 14 May 2009) | 1 line
prevent refleaks from threads
........
r72655 | benjamin.peterson | 2009-05-14 17:40:34 -0500 (Thu, 14 May 2009) | 1 line
a useful decorator for cleaning up threads
........
r72689 | benjamin.peterson | 2009-05-16 13:44:34 -0500 (Sat, 16 May 2009) | 1 line
use skipTest()
........
r72745 | benjamin.peterson | 2009-05-17 09:16:29 -0500 (Sun, 17 May 2009) | 1 line
ignore .rst files in sphinx its self
........
r72750 | benjamin.peterson | 2009-05-17 11:59:27 -0500 (Sun, 17 May 2009) | 1 line
chop off slash
........
r72802 | georg.brandl | 2009-05-20 13:35:27 -0500 (Wed, 20 May 2009) | 1 line
#6051: refer to email examples for better way to construct email messages.
........
r72812 | michael.foord | 2009-05-21 17:57:02 -0500 (Thu, 21 May 2009) | 1 line
Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in TestCase subclasses. Issue 6072.
........
r72822 | georg.brandl | 2009-05-22 04:33:25 -0500 (Fri, 22 May 2009) | 1 line
#6084: fix example.
........
r72824 | georg.brandl | 2009-05-22 04:43:17 -0500 (Fri, 22 May 2009) | 1 line
Fix references to file-related functions and methods (os.* vs file.*).
........
r72826 | georg.brandl | 2009-05-22 04:49:42 -0500 (Fri, 22 May 2009) | 1 line
Fix confusing wording.
........
r72827 | georg.brandl | 2009-05-22 04:50:30 -0500 (Fri, 22 May 2009) | 1 line
s/use/call/
........
r72833 | georg.brandl | 2009-05-22 12:00:17 -0500 (Fri, 22 May 2009) | 1 line
#6078: _warnings is a builtin module and has no standard init_warnings function.
........
r72876 | benjamin.peterson | 2009-05-23 15:59:09 -0500 (Sat, 23 May 2009) | 1 line
remove mention of old ctypes version
........
r72890 | gregory.p.smith | 2009-05-24 13:00:13 -0500 (Sun, 24 May 2009) | 2 lines
add a versionadded tag for set_tunnel
........
r72923 | michael.foord | 2009-05-25 15:36:56 -0500 (Mon, 25 May 2009) | 1 line
Make assertSequenceEqual error messages less cryptic, particularly for nested sequences.
........
r72946 | ronald.oussoren | 2009-05-26 13:44:48 -0500 (Tue, 26 May 2009) | 2 lines
Fixes issue 6110
........
r73026 | r.david.murray | 2009-05-29 14:30:27 -0500 (Fri, 29 May 2009) | 3 lines
Issue 6141: document that the first item of args is still the
command name even when executable is specified.
........
r73042 | benjamin.peterson | 2009-05-29 22:10:52 -0500 (Fri, 29 May 2009) | 1 line
no fdatasync on macos
........
r73045 | georg.brandl | 2009-05-30 02:26:04 -0500 (Sat, 30 May 2009) | 1 line
#6146: fix markup bug.
........
r73047 | georg.brandl | 2009-05-30 05:33:23 -0500 (Sat, 30 May 2009) | 1 line
Fix some more small markup problems.
........
r73065 | antoine.pitrou | 2009-05-30 16:39:25 -0500 (Sat, 30 May 2009) | 3 lines
The test for #5330 wasn't correct.
........
r73068 | antoine.pitrou | 2009-05-30 16:45:40 -0500 (Sat, 30 May 2009) | 3 lines
Update ACKS
........
r73069 | benjamin.peterson | 2009-05-30 19:42:42 -0500 (Sat, 30 May 2009) | 1 line
fix signature
........
2009-06-01 19:42:33 -03:00
|
|
|
:func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use its
|
|
|
|
:meth:`~file.write` method.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-03-26 19:50:57 -03:00
|
|
|
.. versionchanged:: 3.5
|
2015-04-02 06:49:42 -03:00
|
|
|
If the system call is interrupted and the signal handler does not raise an
|
2015-03-26 19:50:57 -03:00
|
|
|
exception, the function now retries the system call instead of raising an
|
|
|
|
:exc:`InterruptedError` exception (see :pep:`475` for the rationale).
|
|
|
|
|
Merged revisions 80030,80067,80069,80080-80081,80084,80432-80433,80465-80470,81059,81065-81067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80030 | georg.brandl | 2010-04-13 08:43:54 +0200 (Di, 13 Apr 2010) | 1 line
Get rid of multi-row cells.
........
r80067 | georg.brandl | 2010-04-14 10:53:38 +0200 (Mi, 14 Apr 2010) | 1 line
#5341: typo.
........
r80069 | georg.brandl | 2010-04-14 15:50:31 +0200 (Mi, 14 Apr 2010) | 1 line
Add an x-ref to where the O_ constants are documented and move the SEEK_ constants after lseek().
........
r80080 | georg.brandl | 2010-04-14 21:16:38 +0200 (Mi, 14 Apr 2010) | 1 line
#8399: add note about Windows and O_BINARY.
........
r80081 | georg.brandl | 2010-04-14 23:34:44 +0200 (Mi, 14 Apr 2010) | 1 line
#5250: document __instancecheck__ and __subclasscheck__. I hope the part about the class/metaclass distinction is understandable.
........
r80084 | georg.brandl | 2010-04-14 23:46:45 +0200 (Mi, 14 Apr 2010) | 1 line
Fix missing.
........
r80432 | georg.brandl | 2010-04-24 10:56:58 +0200 (Sa, 24 Apr 2010) | 1 line
Markup fixes.
........
r80433 | georg.brandl | 2010-04-24 11:08:10 +0200 (Sa, 24 Apr 2010) | 1 line
#7507: quote "!" in pipes.quote(); it is a special character for some shells.
........
r80465 | georg.brandl | 2010-04-25 12:29:17 +0200 (So, 25 Apr 2010) | 1 line
Remove LaTeXy index entry syntax.
........
r80466 | georg.brandl | 2010-04-25 12:54:42 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Better cross-referencing in socket and winreg docs.
........
r80467 | georg.brandl | 2010-04-25 12:55:16 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Remove reference to winreg being the fabled high-level registry interface.
........
r80468 | georg.brandl | 2010-04-25 12:55:58 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Minor spelling changes to _winreg docs.
........
r80469 | georg.brandl | 2010-04-25 12:56:41 +0200 (So, 25 Apr 2010) | 1 line
Fix code example to have valid syntax so that it can be highlighted.
........
r80470 | georg.brandl | 2010-04-25 12:57:15 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Make socket setblocking <-> settimeout examples symmetric.
........
r81059 | georg.brandl | 2010-05-10 23:02:51 +0200 (Mo, 10 Mai 2010) | 1 line
#8642: fix wrong function name.
........
r81065 | georg.brandl | 2010-05-10 23:46:50 +0200 (Mo, 10 Mai 2010) | 1 line
Fix reference direction.
........
r81066 | georg.brandl | 2010-05-10 23:50:57 +0200 (Mo, 10 Mai 2010) | 1 line
Consolidate deprecation messages.
........
r81067 | georg.brandl | 2010-05-10 23:51:33 +0200 (Mo, 10 Mai 2010) | 1 line
Fix typo.
........
2010-05-19 17:57:08 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: writev(fd, buffers, /)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
Write the contents of *buffers* to file descriptor *fd*. *buffers* must be
|
|
|
|
a sequence of :term:`bytes-like objects <bytes-like object>`. Buffers are
|
|
|
|
processed in array order. Entire contents of the first buffer is written
|
|
|
|
before proceeding to the second, and so on.
|
|
|
|
|
|
|
|
Returns the total number of bytes actually written.
|
2016-06-18 15:21:50 -03:00
|
|
|
|
2018-05-30 20:00:04 -03:00
|
|
|
The operating system may set a limit (:func:`sysconf` value
|
|
|
|
``'SC_IOV_MAX'``) on the number of buffers that can be used.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2012-02-08 18:28:36 -04:00
|
|
|
.. _terminal-size:
|
|
|
|
|
|
|
|
Querying the size of a terminal
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: get_terminal_size(fd=STDOUT_FILENO, /)
|
2012-02-08 18:28:36 -04:00
|
|
|
|
|
|
|
Return the size of the terminal window as ``(columns, lines)``,
|
|
|
|
tuple of type :class:`terminal_size`.
|
|
|
|
|
|
|
|
The optional argument ``fd`` (default ``STDOUT_FILENO``, or standard
|
|
|
|
output) specifies which file descriptor should be queried.
|
|
|
|
|
|
|
|
If the file descriptor is not connected to a terminal, an :exc:`OSError`
|
2012-12-18 15:26:36 -04:00
|
|
|
is raised.
|
2012-02-08 18:28:36 -04:00
|
|
|
|
|
|
|
:func:`shutil.get_terminal_size` is the high-level function which
|
|
|
|
should normally be used, ``os.get_terminal_size`` is the low-level
|
|
|
|
implementation.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2012-02-08 18:28:36 -04:00
|
|
|
|
2012-06-24 09:05:40 -03:00
|
|
|
.. class:: terminal_size
|
2012-02-08 18:28:36 -04:00
|
|
|
|
2012-06-24 09:05:40 -03:00
|
|
|
A subclass of tuple, holding ``(columns, lines)`` of the terminal window size.
|
2012-02-08 18:28:36 -04:00
|
|
|
|
|
|
|
.. attribute:: columns
|
|
|
|
|
|
|
|
Width of the terminal window in characters.
|
|
|
|
|
|
|
|
.. attribute:: lines
|
|
|
|
|
|
|
|
Height of the terminal window in characters.
|
|
|
|
|
|
|
|
|
2013-08-27 19:53:59 -03:00
|
|
|
.. _fd_inheritance:
|
|
|
|
|
|
|
|
Inheritance of File Descriptors
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-09-15 05:37:57 -03:00
|
|
|
.. versionadded:: 3.4
|
|
|
|
|
|
|
|
A file descriptor has an "inheritable" flag which indicates if the file descriptor
|
|
|
|
can be inherited by child processes. Since Python 3.4, file descriptors
|
2013-08-27 19:53:59 -03:00
|
|
|
created by Python are non-inheritable by default.
|
|
|
|
|
|
|
|
On UNIX, non-inheritable file descriptors are closed in child processes at the
|
|
|
|
execution of a new program, other file descriptors are inherited.
|
|
|
|
|
|
|
|
On Windows, non-inheritable handles and file descriptors are closed in child
|
2013-09-15 05:37:57 -03:00
|
|
|
processes, except for standard streams (file descriptors 0, 1 and 2: stdin, stdout
|
2013-10-13 14:13:37 -03:00
|
|
|
and stderr), which are always inherited. Using :func:`spawn\* <spawnl>` functions,
|
2013-08-27 19:53:59 -03:00
|
|
|
all inheritable handles and all inheritable file descriptors are inherited.
|
|
|
|
Using the :mod:`subprocess` module, all file descriptors except standard
|
2013-09-15 05:37:57 -03:00
|
|
|
streams are closed, and inheritable handles are only inherited if the
|
|
|
|
*close_fds* parameter is ``False``.
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, the file
|
|
|
|
descriptor cannot be modified.
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: get_inheritable(fd, /)
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2013-09-15 05:37:57 -03:00
|
|
|
Get the "inheritable" flag of the specified file descriptor (a boolean).
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: set_inheritable(fd, inheritable, /)
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2013-09-15 05:37:57 -03:00
|
|
|
Set the "inheritable" flag of the specified file descriptor.
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: get_handle_inheritable(handle, /)
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2013-09-15 05:37:57 -03:00
|
|
|
Get the "inheritable" flag of the specified handle (a boolean).
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Windows.
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: set_handle_inheritable(handle, inheritable, /)
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2013-09-15 05:37:57 -03:00
|
|
|
Set the "inheritable" flag of the specified handle.
|
2013-08-27 19:53:59 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Windows.
|
2013-08-27 19:53:59 -03:00
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. _os-file-dir:
|
|
|
|
|
|
|
|
Files and Directories
|
|
|
|
---------------------
|
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
On some Unix platforms, many of these functions support one or more of these
|
|
|
|
features:
|
|
|
|
|
|
|
|
.. _path_fd:
|
|
|
|
|
2012-06-25 07:27:33 -03:00
|
|
|
* **specifying a file descriptor:**
|
2019-05-06 09:39:13 -03:00
|
|
|
Normally the *path* argument provided to functions in the :mod:`os` module
|
|
|
|
must be a string specifying a file path. However, some functions now
|
|
|
|
alternatively accept an open file descriptor for their *path* argument.
|
|
|
|
The function will then operate on the file referred to by the descriptor.
|
|
|
|
(For POSIX systems, Python will call the variant of the function prefixed
|
|
|
|
with ``f`` (e.g. call ``fchdir`` instead of ``chdir``).)
|
|
|
|
|
|
|
|
You can check whether or not *path* can be specified as a file descriptor
|
|
|
|
for a particular function on your platform using :data:`os.supports_fd`.
|
|
|
|
If this functionality is unavailable, using it will raise a
|
|
|
|
:exc:`NotImplementedError`.
|
2012-06-24 06:45:20 -03:00
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
If the function also supports *dir_fd* or *follow_symlinks* arguments, it's
|
2012-06-24 06:45:20 -03:00
|
|
|
an error to specify one of those when supplying *path* as a file descriptor.
|
|
|
|
|
|
|
|
.. _dir_fd:
|
|
|
|
|
2012-06-25 07:27:33 -03:00
|
|
|
* **paths relative to directory descriptors:** If *dir_fd* is not ``None``, it
|
2012-06-24 06:45:20 -03:00
|
|
|
should be a file descriptor referring to a directory, and the path to operate
|
|
|
|
on should be relative; path will then be relative to that directory. If the
|
2012-06-25 03:33:56 -03:00
|
|
|
path is absolute, *dir_fd* is ignored. (For POSIX systems, Python will call
|
2019-05-06 09:39:13 -03:00
|
|
|
the variant of the function with an ``at`` suffix and possibly prefixed with
|
|
|
|
``f`` (e.g. call ``faccessat`` instead of ``access``).
|
2012-06-24 06:45:20 -03:00
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
You can check whether or not *dir_fd* is supported for a particular function
|
|
|
|
on your platform using :data:`os.supports_dir_fd`. If it's unavailable,
|
|
|
|
using it will raise a :exc:`NotImplementedError`.
|
2012-06-24 06:45:20 -03:00
|
|
|
|
|
|
|
.. _follow_symlinks:
|
|
|
|
|
2012-06-25 07:27:33 -03:00
|
|
|
* **not following symlinks:** If *follow_symlinks* is
|
2012-06-24 06:45:20 -03:00
|
|
|
``False``, and the last element of the path to operate on is a symbolic link,
|
2019-05-06 09:39:13 -03:00
|
|
|
the function will operate on the symbolic link itself rather than the file
|
|
|
|
pointed to by the link. (For POSIX systems, Python will call the ``l...``
|
|
|
|
variant of the function.)
|
2012-06-24 06:45:20 -03:00
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
You can check whether or not *follow_symlinks* is supported for a particular
|
|
|
|
function on your platform using :data:`os.supports_follow_symlinks`.
|
|
|
|
If it's unavailable, using it will raise a :exc:`NotImplementedError`.
|
2012-06-24 06:45:20 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. function:: access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Use the real uid/gid to test for access to *path*. Note that most operations
|
|
|
|
will use the effective uid/gid, therefore this routine can be used in a
|
|
|
|
suid/sgid environment to test if the invoking user has the specified access to
|
|
|
|
*path*. *mode* should be :const:`F_OK` to test the existence of *path*, or it
|
|
|
|
can be the inclusive OR of one or more of :const:`R_OK`, :const:`W_OK`, and
|
|
|
|
:const:`X_OK` to test permissions. Return :const:`True` if access is allowed,
|
|
|
|
:const:`False` if not. See the Unix man page :manpage:`access(2)` for more
|
2010-05-06 20:03:05 -03:00
|
|
|
information.
|
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support specifying :ref:`paths relative to directory
|
|
|
|
descriptors <dir_fd>` and :ref:`not following symlinks <follow_symlinks>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
|
|
|
If *effective_ids* is ``True``, :func:`access` will perform its access
|
|
|
|
checks using the effective uid/gid instead of the real uid/gid.
|
|
|
|
*effective_ids* may not be supported on your platform; you can check whether
|
|
|
|
or not it is available using :data:`os.supports_effective_ids`. If it is
|
|
|
|
unavailable, using it will raise a :exc:`NotImplementedError`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. note::
|
|
|
|
|
2009-07-26 12:02:41 -03:00
|
|
|
Using :func:`access` to check if a user is authorized to e.g. open a file
|
|
|
|
before actually doing so using :func:`open` creates a security hole,
|
|
|
|
because the user might exploit the short time interval between checking
|
2011-05-20 13:41:13 -03:00
|
|
|
and opening the file to manipulate it. It's preferable to use :term:`EAFP`
|
|
|
|
techniques. For example::
|
|
|
|
|
|
|
|
if os.access("myfile", os.R_OK):
|
|
|
|
with open("myfile") as fp:
|
|
|
|
return fp.read()
|
|
|
|
return "some default data"
|
|
|
|
|
|
|
|
is better written as::
|
|
|
|
|
|
|
|
try:
|
|
|
|
fp = open("myfile")
|
2011-10-12 15:10:51 -03:00
|
|
|
except PermissionError:
|
|
|
|
return "some default data"
|
2011-05-20 13:41:13 -03:00
|
|
|
else:
|
|
|
|
with fp:
|
|
|
|
return fp.read()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
I/O operations may fail even when :func:`access` indicates that they would
|
|
|
|
succeed, particularly for operations on network filesystems which may have
|
|
|
|
permissions semantics beyond the usual POSIX permission-bit model.
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
Added the *dir_fd*, *effective_ids*, and *follow_symlinks* parameters.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. data:: F_OK
|
2012-06-24 07:50:06 -03:00
|
|
|
R_OK
|
|
|
|
W_OK
|
|
|
|
X_OK
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
Values to pass as the *mode* parameter of :func:`access` to test the
|
|
|
|
existence, readability, writability and executability of *path*,
|
|
|
|
respectively.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: chdir(path)
|
|
|
|
|
|
|
|
.. index:: single: directory; changing
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Change the current working directory to *path*.
|
|
|
|
|
2012-06-25 07:27:33 -03:00
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>`. The
|
2012-06-24 06:45:20 -03:00
|
|
|
descriptor must refer to an opened directory, not an open file.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2019-07-06 23:44:01 -03:00
|
|
|
This function can raise :exc:`OSError` and subclasses such as
|
2019-07-06 22:20:15 -03:00
|
|
|
:exc:`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chdir path os.chdir
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
Added support for specifying *path* as a file descriptor
|
2012-06-24 06:45:20 -03:00
|
|
|
on some platforms.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. function:: chflags(path, flags, *, follow_symlinks=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Set the flags of *path* to the numeric *flags*. *flags* may take a combination
|
|
|
|
(bitwise OR) of the following values (as defined in the :mod:`stat` module):
|
|
|
|
|
2023-07-21 06:40:37 -03:00
|
|
|
* :const:`stat.UF_NODUMP`
|
|
|
|
* :const:`stat.UF_IMMUTABLE`
|
|
|
|
* :const:`stat.UF_APPEND`
|
|
|
|
* :const:`stat.UF_OPAQUE`
|
|
|
|
* :const:`stat.UF_NOUNLINK`
|
|
|
|
* :const:`stat.UF_COMPRESSED`
|
|
|
|
* :const:`stat.UF_HIDDEN`
|
|
|
|
* :const:`stat.SF_ARCHIVED`
|
|
|
|
* :const:`stat.SF_IMMUTABLE`
|
|
|
|
* :const:`stat.SF_APPEND`
|
|
|
|
* :const:`stat.SF_NOUNLINK`
|
|
|
|
* :const:`stat.SF_SNAPSHOT`
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support :ref:`not following symlinks <follow_symlinks>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chflags path,flags os.chflags
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
The *follow_symlinks* argument.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. function:: chmod(path, mode, *, dir_fd=None, follow_symlinks=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Change the mode of *path* to the numeric *mode*. *mode* may take one of the
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
following values (as defined in the :mod:`stat` module) or bitwise ORed
|
2007-08-15 11:28:22 -03:00
|
|
|
combinations of them:
|
|
|
|
|
2023-07-21 06:40:37 -03:00
|
|
|
* :const:`stat.S_ISUID`
|
|
|
|
* :const:`stat.S_ISGID`
|
|
|
|
* :const:`stat.S_ENFMT`
|
|
|
|
* :const:`stat.S_ISVTX`
|
|
|
|
* :const:`stat.S_IREAD`
|
|
|
|
* :const:`stat.S_IWRITE`
|
|
|
|
* :const:`stat.S_IEXEC`
|
|
|
|
* :const:`stat.S_IRWXU`
|
|
|
|
* :const:`stat.S_IRUSR`
|
|
|
|
* :const:`stat.S_IWUSR`
|
|
|
|
* :const:`stat.S_IXUSR`
|
|
|
|
* :const:`stat.S_IRWXG`
|
|
|
|
* :const:`stat.S_IRGRP`
|
|
|
|
* :const:`stat.S_IWGRP`
|
|
|
|
* :const:`stat.S_IXGRP`
|
|
|
|
* :const:`stat.S_IRWXO`
|
|
|
|
* :const:`stat.S_IROTH`
|
|
|
|
* :const:`stat.S_IWOTH`
|
|
|
|
* :const:`stat.S_IXOTH`
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>`,
|
|
|
|
:ref:`paths relative to directory descriptors <dir_fd>` and :ref:`not
|
|
|
|
following symlinks <follow_symlinks>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. note::
|
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
Although Windows supports :func:`chmod`, you can only set the file's
|
|
|
|
read-only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD``
|
|
|
|
constants or a corresponding integer value). All other bits are ignored.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is limited on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chmod path,mode,dir_fd os.chmod
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
Added support for specifying *path* as an open file descriptor,
|
|
|
|
and the *dir_fd* and *follow_symlinks* arguments.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
|
|
|
|
.. function:: chown(path, uid, gid, *, dir_fd=None, follow_symlinks=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
Change the owner and group id of *path* to the numeric *uid* and *gid*. To
|
|
|
|
leave one of the ids unchanged, set it to -1.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>`,
|
|
|
|
:ref:`paths relative to directory descriptors <dir_fd>` and :ref:`not
|
|
|
|
following symlinks <follow_symlinks>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2011-08-22 18:28:27 -03:00
|
|
|
See :func:`shutil.chown` for a higher-level function that accepts names in
|
|
|
|
addition to numeric ids.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chown path,uid,gid,dir_fd os.chown
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is limited on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
2019-05-06 09:39:13 -03:00
|
|
|
Added support for specifying *path* as an open file descriptor,
|
2012-06-22 20:30:09 -03:00
|
|
|
and the *dir_fd* and *follow_symlinks* arguments.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Supports a :term:`path-like object`.
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
.. function:: chroot(path)
|
|
|
|
|
2012-06-24 08:29:09 -03:00
|
|
|
Change the root directory of the current process to *path*.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
.. function:: fchdir(fd)
|
|
|
|
|
|
|
|
Change the current working directory to the directory represented by the file
|
|
|
|
descriptor *fd*. The descriptor must refer to an opened directory, not an
|
2012-06-25 02:40:32 -03:00
|
|
|
open file. As of Python 3.3, this is equivalent to ``os.chdir(fd)``.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chdir path os.fchdir
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: getcwd()
|
|
|
|
|
|
|
|
Return a string representing the current working directory.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getcwdb()
|
|
|
|
|
|
|
|
Return a bytestring representing the current working directory.
|
|
|
|
|
2019-06-26 12:31:12 -03:00
|
|
|
.. versionchanged:: 3.8
|
|
|
|
The function now uses the UTF-8 encoding on Windows, rather than the ANSI
|
|
|
|
code page: see :pep:`529` for the rationale. The function is no longer
|
|
|
|
deprecated on Windows.
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: lchflags(path, flags)
|
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do
|
2012-06-25 02:40:32 -03:00
|
|
|
not follow symbolic links. As of Python 3.3, this is equivalent to
|
2012-06-24 07:38:14 -03:00
|
|
|
``os.chflags(path, flags, follow_symlinks=False)``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chflags path,flags os.lchflags
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2007-12-01 08:22:32 -04:00
|
|
|
.. function:: lchmod(path, mode)
|
|
|
|
|
|
|
|
Change the mode of *path* to the numeric *mode*. If path is a symlink, this
|
2012-06-24 06:45:20 -03:00
|
|
|
affects the symlink rather than the target. See the docs for :func:`chmod`
|
2012-06-25 02:40:32 -03:00
|
|
|
for possible values of *mode*. As of Python 3.3, this is equivalent to
|
2012-06-24 07:38:14 -03:00
|
|
|
``os.chmod(path, mode, follow_symlinks=False)``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chmod path,mode,dir_fd os.lchmod
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-12-01 08:22:32 -04:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
2007-12-01 08:22:32 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: lchown(path, uid, gid)
|
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
Change the owner and group id of *path* to the numeric *uid* and *gid*. This
|
2012-06-25 02:40:32 -03:00
|
|
|
function will not follow symbolic links. As of Python 3.3, this is equivalent
|
2012-06-24 07:38:14 -03:00
|
|
|
to ``os.chown(path, uid, gid, follow_symlinks=False)``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.chown path,uid,gid,dir_fd os.lchown
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. function:: link(src, dst, *, src_dir_fd=None, dst_dir_fd=None, follow_symlinks=True)
|
2011-08-31 23:15:17 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
Create a hard link pointing to *src* named *dst*.
|
2011-08-31 23:15:17 -03:00
|
|
|
|
2012-06-25 03:33:56 -03:00
|
|
|
This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to
|
|
|
|
supply :ref:`paths relative to directory descriptors <dir_fd>`, and :ref:`not
|
|
|
|
following symlinks <follow_symlinks>`.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.link src,dst,src_dir_fd,dst_dir_fd os.link
|
|
|
|
|
2023-07-26 15:38:59 -03:00
|
|
|
.. availability:: Unix, Windows, not Emscripten.
|
2010-11-24 16:24:31 -04:00
|
|
|
|
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Added Windows support.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
Added the *src_dir_fd*, *dst_dir_fd*, and *follow_symlinks* arguments.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object` for *src* and *dst*.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-24 07:09:11 -03:00
|
|
|
.. function:: listdir(path='.')
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line
raise a better error
........
r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines
#4392: fix parameter name.
........
r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines
#4399: fix typo.
........
r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines
replace reference to debugger-hooks
........
r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line
#4396 make the parser module correctly validate the with syntax
........
r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines
Fix typo.
........
r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines
#4404: make clear what "path" is.
........
r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line
fix typo in sqlite3 docs
........
r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines
issue4238: bsd support for cpu_count
........
r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line
Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line
SVN format 9 is the same it seems
........
r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines
Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
........
r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines
Reflow long lines.
........
r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines
Fix a small typo in docstring
........
r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line
StringIO.close() stops you from using the buffer, too
........
r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line
note the version that works
........
r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line
Issue #4365: Add crtassem.h constants to the msvcrt module.
........
r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line
w# requires Py_ssize_t
........
r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line
fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 18:46:23 -04:00
|
|
|
Return a list containing the names of the entries in the directory given by
|
2012-06-25 08:42:23 -03:00
|
|
|
*path*. The list is in arbitrary order, and does not include the special
|
|
|
|
entries ``'.'`` and ``'..'`` even if they are present in the directory.
|
2020-09-04 15:19:30 -03:00
|
|
|
If a file is removed from or added to the directory during the call of
|
|
|
|
this function, whether a name for that file be included is unspecified.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
*path* may be a :term:`path-like object`. If *path* is of type ``bytes``
|
|
|
|
(directly or indirectly through the :class:`PathLike` interface),
|
|
|
|
the filenames returned will also be of type ``bytes``;
|
2012-06-25 08:42:23 -03:00
|
|
|
in all other circumstances, they will be of type ``str``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-25 07:27:33 -03:00
|
|
|
This function can also support :ref:`specifying a file descriptor
|
|
|
|
<path_fd>`; the file descriptor must refer to a directory.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2019-06-27 14:47:59 -03:00
|
|
|
.. audit-event:: os.listdir path os.listdir
|
2019-06-24 12:42:54 -03:00
|
|
|
|
2012-06-25 08:42:23 -03:00
|
|
|
.. note::
|
|
|
|
To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`.
|
|
|
|
|
2015-03-07 20:58:04 -04:00
|
|
|
.. seealso::
|
|
|
|
|
2015-05-15 04:12:58 -03:00
|
|
|
The :func:`scandir` function returns directory entries along with
|
|
|
|
file attribute information, giving better performance for many
|
|
|
|
common use cases.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2010-07-23 09:16:41 -03:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
The *path* parameter became optional.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-08-31 23:15:17 -03:00
|
|
|
.. versionadded:: 3.3
|
2019-05-06 09:39:13 -03:00
|
|
|
Added support for specifying *path* as an open file descriptor.
|
2011-08-31 23:15:17 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2011-08-31 23:15:17 -03:00
|
|
|
|
2023-03-10 11:41:32 -04:00
|
|
|
.. function:: listdrives()
|
|
|
|
|
|
|
|
Return a list containing the names of drives on a Windows system.
|
|
|
|
|
|
|
|
A drive name typically looks like ``'C:\\'``. Not every drive name
|
|
|
|
will be associated with a volume, and some may be inaccessible for
|
|
|
|
a variety of reasons, including permissions, network connectivity
|
|
|
|
or missing media. This function does not test for access.
|
|
|
|
|
|
|
|
May raise :exc:`OSError` if an error occurs collecting the drive
|
|
|
|
names.
|
|
|
|
|
|
|
|
.. audit-event:: os.listdrives "" os.listdrives
|
|
|
|
|
|
|
|
.. availability:: Windows
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: listmounts(volume)
|
|
|
|
|
|
|
|
Return a list containing the mount points for a volume on a Windows
|
|
|
|
system.
|
|
|
|
|
|
|
|
*volume* must be represented as a GUID path, like those returned by
|
|
|
|
:func:`os.listvolumes`. Volumes may be mounted in multiple locations
|
|
|
|
or not at all. In the latter case, the list will be empty. Mount
|
|
|
|
points that are not associated with a volume will not be returned by
|
|
|
|
this function.
|
|
|
|
|
|
|
|
The mount points return by this function will be absolute paths, and
|
|
|
|
may be longer than the drive name.
|
|
|
|
|
|
|
|
Raises :exc:`OSError` if the volume is not recognized or if an error
|
|
|
|
occurs collecting the paths.
|
|
|
|
|
|
|
|
.. audit-event:: os.listmounts volume os.listmounts
|
|
|
|
|
|
|
|
.. availability:: Windows
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: listvolumes()
|
|
|
|
|
|
|
|
Return a list containing the volumes in the system.
|
|
|
|
|
|
|
|
Volumes are typically represented as a GUID path that looks like
|
|
|
|
``\\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\``. Files can
|
|
|
|
usually be accessed through a GUID path, permissions allowing.
|
|
|
|
However, users are generally not familiar with them, and so the
|
|
|
|
recommended use of this function is to retrieve mount points
|
|
|
|
using :func:`os.listmounts`.
|
|
|
|
|
|
|
|
May raise :exc:`OSError` if an error occurs collecting the volumes.
|
|
|
|
|
|
|
|
.. audit-event:: os.listvolumes "" os.listvolumes
|
|
|
|
|
|
|
|
.. availability:: Windows
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
|
|
|
|
2020-12-16 21:37:28 -04:00
|
|
|
.. function:: lstat(path, *, dir_fd=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-08-19 14:03:26 -03:00
|
|
|
Perform the equivalent of an :c:func:`!lstat` system call on the given path.
|
2014-07-24 07:42:16 -03:00
|
|
|
Similar to :func:`~os.stat`, but does not follow symbolic links. Return a
|
|
|
|
:class:`stat_result` object.
|
|
|
|
|
|
|
|
On platforms that do not support symbolic links, this is an alias for
|
|
|
|
:func:`~os.stat`.
|
|
|
|
|
|
|
|
As of Python 3.3, this is equivalent to ``os.stat(path, dir_fd=dir_fd,
|
|
|
|
follow_symlinks=False)``.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can also support :ref:`paths relative to directory descriptors
|
|
|
|
<dir_fd>`.
|
2010-07-09 12:15:09 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
.. seealso::
|
|
|
|
|
2015-04-27 07:53:28 -03:00
|
|
|
The :func:`.stat` function.
|
2014-07-24 07:42:16 -03:00
|
|
|
|
2010-07-10 05:58:37 -03:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Added support for Windows 6.0 (Vista) symbolic links.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
Added the *dir_fd* parameter.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
2021-04-25 18:24:41 -03:00
|
|
|
Accepts a :term:`path-like object`.
|
2016-09-06 19:55:02 -03:00
|
|
|
|
2019-08-21 19:27:33 -03:00
|
|
|
.. versionchanged:: 3.8
|
|
|
|
On Windows, now opens reparse points that represent another path
|
|
|
|
(name surrogates), including symbolic links and directory junctions.
|
|
|
|
Other kinds of reparse points are resolved by the operating system as
|
|
|
|
for :func:`~os.stat`.
|
|
|
|
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
.. function:: mkdir(path, mode=0o777, *, dir_fd=None)
|
|
|
|
|
|
|
|
Create a directory named *path* with numeric mode *mode*.
|
|
|
|
|
2022-03-14 16:57:10 -03:00
|
|
|
If the directory already exists, :exc:`FileExistsError` is raised. If a parent
|
|
|
|
directory in the path does not exist, :exc:`FileNotFoundError` is raised.
|
2016-06-02 16:41:20 -03:00
|
|
|
|
|
|
|
.. _mkdir_modebits:
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
On some systems, *mode* is ignored. Where it is used, the current umask
|
2016-06-02 16:41:20 -03:00
|
|
|
value is first masked out. If bits other than the last 9 (i.e. the last 3
|
|
|
|
digits of the octal representation of the *mode*) are set, their meaning is
|
|
|
|
platform-dependent. On some platforms, they are ignored and you should call
|
|
|
|
:func:`chmod` explicitly to set them.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
This function can also support :ref:`paths relative to directory descriptors
|
|
|
|
<dir_fd>`.
|
|
|
|
|
|
|
|
It is also possible to create temporary directories; see the
|
|
|
|
:mod:`tempfile` module's :func:`tempfile.mkdtemp` function.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.mkdir path,mode,dir_fd os.mkdir
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
The *dir_fd* argument.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2014-03-20 11:42:01 -03:00
|
|
|
.. function:: makedirs(name, mode=0o777, exist_ok=False)
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
.. index::
|
|
|
|
single: directory; creating
|
|
|
|
single: UNC paths; and os.makedirs()
|
|
|
|
|
|
|
|
Recursive directory creation function. Like :func:`mkdir`, but makes all
|
2012-10-08 02:44:54 -03:00
|
|
|
intermediate-level directories needed to contain the leaf directory.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2017-03-24 08:27:42 -03:00
|
|
|
The *mode* parameter is passed to :func:`mkdir` for creating the leaf
|
|
|
|
directory; see :ref:`the mkdir() description <mkdir_modebits>` for how it
|
2022-07-05 06:16:10 -03:00
|
|
|
is interpreted. To set the file permission bits of any newly created parent
|
2017-03-24 08:27:42 -03:00
|
|
|
directories you can set the umask before invoking :func:`makedirs`. The
|
|
|
|
file permission bits of existing parent directories are not changed.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2021-12-23 05:17:31 -04:00
|
|
|
If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is
|
2019-07-05 05:41:35 -03:00
|
|
|
raised if the target directory already exists.
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
:func:`makedirs` will become confused if the path elements to create
|
2012-10-08 02:44:54 -03:00
|
|
|
include :data:`pardir` (eg. ".." on UNIX systems).
|
2012-06-24 07:50:06 -03:00
|
|
|
|
|
|
|
This function handles UNC paths correctly.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.mkdir path,mode,dir_fd os.makedirs
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
The *exist_ok* parameter.
|
|
|
|
|
2014-04-01 20:22:06 -03:00
|
|
|
.. versionchanged:: 3.4.1
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-04-01 20:22:06 -03:00
|
|
|
Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed,
|
2014-04-01 20:17:57 -03:00
|
|
|
:func:`makedirs` would still raise an error if *mode* did not match the
|
|
|
|
mode of the existing directory. Since this behavior was impossible to
|
2014-04-01 20:22:06 -03:00
|
|
|
implement safely, it was removed in Python 3.4.1. See :issue:`21082`.
|
Merged revisions 58742-58816 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58745 | georg.brandl | 2007-11-01 10:19:33 -0700 (Thu, 01 Nov 2007) | 2 lines
#1364: os.lstat is available on Windows too, as an alias to os.stat.
........
r58750 | christian.heimes | 2007-11-01 12:48:10 -0700 (Thu, 01 Nov 2007) | 1 line
Backport of import tests for bug http://bugs.python.org/issue1293 and bug http://bugs.python.org/issue1342
........
r58751 | christian.heimes | 2007-11-01 13:11:06 -0700 (Thu, 01 Nov 2007) | 1 line
Removed non ASCII text from test as requested by Guido. Sorry :/
........
r58753 | georg.brandl | 2007-11-01 13:37:02 -0700 (Thu, 01 Nov 2007) | 2 lines
Fix markup glitch.
........
r58757 | gregory.p.smith | 2007-11-01 14:08:14 -0700 (Thu, 01 Nov 2007) | 4 lines
Fix bug introduced in revision 58385. Database keys could no longer
have NULL bytes in them. Replace the errant strdup with a
malloc+memcpy. Adds a unit test for the correct behavior.
........
r58758 | gregory.p.smith | 2007-11-01 14:15:36 -0700 (Thu, 01 Nov 2007) | 3 lines
Undo revision 58533 58534 fixes. Those were a workaround for
a problem introduced by 58385.
........
r58759 | gregory.p.smith | 2007-11-01 14:17:47 -0700 (Thu, 01 Nov 2007) | 2 lines
false "fix" undone as correct problem was found and fixed.
........
r58765 | mark.summerfield | 2007-11-02 01:24:59 -0700 (Fri, 02 Nov 2007) | 3 lines
Added more file-handling related cross-references.
........
r58766 | nick.coghlan | 2007-11-02 03:09:12 -0700 (Fri, 02 Nov 2007) | 1 line
Fix for bug 1705170 - contextmanager swallowing StopIteration (2.5 backport candidate)
........
r58784 | thomas.heller | 2007-11-02 12:10:24 -0700 (Fri, 02 Nov 2007) | 4 lines
Issue #1292: On alpha, arm, ppc, and s390 linux systems the
--with-system-ffi configure option defaults to "yes" because the
bundled libffi sources are too old.
........
r58785 | thomas.heller | 2007-11-02 12:11:23 -0700 (Fri, 02 Nov 2007) | 1 line
Enable the full ctypes c_longdouble tests again.
........
r58796 | georg.brandl | 2007-11-02 13:06:17 -0700 (Fri, 02 Nov 2007) | 4 lines
Make "hashable" a glossary entry and clarify docs on __cmp__, __eq__ and __hash__.
I hope the concept of hashability is better understandable now.
Thanks to Tim Hatch for pointing out the flaws here.
........
2007-11-02 20:46:40 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2017-03-24 08:27:42 -03:00
|
|
|
.. versionchanged:: 3.7
|
|
|
|
The *mode* argument no longer affects the file permission bits of
|
2022-07-05 06:16:10 -03:00
|
|
|
newly created intermediate-level directories.
|
2017-03-24 08:27:42 -03:00
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. function:: mkfifo(path, mode=0o666, *, dir_fd=None)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
Create a FIFO (a named pipe) named *path* with numeric mode *mode*.
|
|
|
|
The current umask value is first masked out from the mode.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can also support :ref:`paths relative to directory descriptors
|
|
|
|
<dir_fd>`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
FIFOs are pipes that can be accessed like regular files. FIFOs exist until they
|
|
|
|
are deleted (for example with :func:`os.unlink`). Generally, FIFOs are used as
|
|
|
|
rendezvous between "client" and "server" type processes: the server opens the
|
|
|
|
FIFO for reading, and the client opens it for writing. Note that :func:`mkfifo`
|
|
|
|
doesn't open the FIFO --- it just creates the rendezvous point.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
The *dir_fd* argument.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-09-08 22:01:13 -03:00
|
|
|
.. function:: mknod(path, mode=0o600, device=0, *, dir_fd=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Create a filesystem node (file, device special file or named pipe) named
|
2015-09-08 22:01:13 -03:00
|
|
|
*path*. *mode* specifies both the permissions to use and the type of node
|
2009-09-02 17:34:52 -03:00
|
|
|
to be created, being combined (bitwise OR) with one of ``stat.S_IFREG``,
|
|
|
|
``stat.S_IFCHR``, ``stat.S_IFBLK``, and ``stat.S_IFIFO`` (those constants are
|
|
|
|
available in :mod:`stat`). For ``stat.S_IFCHR`` and ``stat.S_IFBLK``,
|
|
|
|
*device* defines the newly created device special file (probably using
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`os.makedev`), otherwise it is ignored.
|
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can also support :ref:`paths relative to directory descriptors
|
|
|
|
<dir_fd>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2016-09-26 16:50:11 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
The *dir_fd* argument.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: major(device, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
Extract the device major number from a raw device number (usually the
|
2023-07-26 16:29:23 -03:00
|
|
|
:attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: minor(device, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
Extract the device minor number from a raw device number (usually the
|
2023-07-26 16:29:23 -03:00
|
|
|
:attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: makedev(major, minor, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
Compose a raw device number from the major and minor device numbers.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: pathconf(path, name)
|
|
|
|
|
|
|
|
Return system configuration information relevant to a named file. *name*
|
|
|
|
specifies the configuration value to retrieve; it may be a string which is the
|
|
|
|
name of a defined system value; these names are specified in a number of
|
|
|
|
standards (POSIX.1, Unix 95, Unix 98, and others). Some platforms define
|
|
|
|
additional names as well. The names known to the host operating system are
|
|
|
|
given in the ``pathconf_names`` dictionary. For configuration variables not
|
|
|
|
included in that mapping, passing an integer for *name* is also accepted.
|
|
|
|
|
|
|
|
If *name* is a string and is not known, :exc:`ValueError` is raised. If a
|
|
|
|
specific value for *name* is not supported by the host system, even if it is
|
|
|
|
included in ``pathconf_names``, an :exc:`OSError` is raised with
|
|
|
|
:const:`errno.EINVAL` for the error number.
|
|
|
|
|
2012-06-25 07:27:33 -03:00
|
|
|
This function can support :ref:`specifying a file descriptor
|
2012-06-24 07:55:33 -03:00
|
|
|
<path_fd>`.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. data:: pathconf_names
|
|
|
|
|
|
|
|
Dictionary mapping names accepted by :func:`pathconf` and :func:`fpathconf` to
|
|
|
|
the integer values defined for those names by the host operating system. This
|
2012-06-24 08:29:09 -03:00
|
|
|
can be used to determine the set of names known to the system.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. function:: readlink(path, *, dir_fd=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return a string representing the path to which the symbolic link points. The
|
2012-06-24 06:45:20 -03:00
|
|
|
result may be either an absolute or relative pathname; if it is relative, it
|
|
|
|
may be converted to an absolute pathname using
|
|
|
|
``os.path.join(os.path.dirname(path), result)``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
If the *path* is a string object (directly or indirectly through a
|
|
|
|
:class:`PathLike` interface), the result will also be a string object,
|
2016-04-14 23:14:19 -03:00
|
|
|
and the call may raise a UnicodeDecodeError. If the *path* is a bytes
|
2016-09-06 19:55:02 -03:00
|
|
|
object (direct or indirectly), the result will be a bytes object.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can also support :ref:`paths relative to directory descriptors
|
|
|
|
<dir_fd>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2019-08-21 19:27:33 -03:00
|
|
|
When trying to resolve a path that may contain links, use
|
|
|
|
:func:`~os.path.realpath` to properly handle recursion and platform
|
|
|
|
differences.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2010-07-09 12:15:09 -03:00
|
|
|
|
2010-07-10 05:58:37 -03:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Added support for Windows 6.0 (Vista) symbolic links.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
The *dir_fd* argument.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
2018-08-15 07:03:41 -03:00
|
|
|
Accepts a :term:`path-like object` on Unix.
|
2016-09-06 19:55:02 -03:00
|
|
|
|
2018-08-15 07:03:41 -03:00
|
|
|
.. versionchanged:: 3.8
|
|
|
|
Accepts a :term:`path-like object` and a bytes object on Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-08-21 19:27:33 -03:00
|
|
|
.. versionchanged:: 3.8
|
|
|
|
Added support for directory junctions, and changed to return the
|
|
|
|
substitution path (which typically includes ``\\?\`` prefix) rather
|
|
|
|
than the optional "print name" field that was previously returned.
|
|
|
|
|
2012-06-23 20:55:07 -03:00
|
|
|
.. function:: remove(path, *, dir_fd=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-07-05 05:41:35 -03:00
|
|
|
Remove (delete) the file *path*. If *path* is a directory, an
|
2022-11-21 06:08:06 -04:00
|
|
|
:exc:`OSError` is raised. Use :func:`rmdir` to remove directories.
|
2021-04-26 01:21:50 -03:00
|
|
|
If the file does not exist, a :exc:`FileNotFoundError` is raised.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support :ref:`paths relative to directory descriptors
|
|
|
|
<dir_fd>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
|
|
|
On Windows, attempting to remove a file that is in use causes an exception to
|
|
|
|
be raised; on Unix, the directory entry is removed but the storage allocated
|
|
|
|
to the file is not made available until the original file is no longer in use.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2015-12-28 21:28:19 -04:00
|
|
|
This function is semantically identical to :func:`unlink`.
|
2012-06-23 20:55:07 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.remove path,dir_fd os.remove
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
2012-06-23 20:55:07 -03:00
|
|
|
The *dir_fd* argument.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-03-20 11:42:01 -03:00
|
|
|
.. function:: removedirs(name)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. index:: single: directory; deleting
|
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
Remove directories recursively. Works like :func:`rmdir` except that, if the
|
2007-08-15 11:28:22 -03:00
|
|
|
leaf directory is successfully removed, :func:`removedirs` tries to
|
|
|
|
successively remove every parent directory mentioned in *path* until an error
|
|
|
|
is raised (which is ignored, because it generally means that a parent directory
|
|
|
|
is not empty). For example, ``os.removedirs('foo/bar/baz')`` will first remove
|
|
|
|
the directory ``'foo/bar/baz'``, and then remove ``'foo/bar'`` and ``'foo'`` if
|
|
|
|
they are empty. Raises :exc:`OSError` if the leaf directory could not be
|
|
|
|
successfully removed.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.remove path,dir_fd os.removedirs
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. function:: rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-07-05 05:41:35 -03:00
|
|
|
Rename the file or directory *src* to *dst*. If *dst* exists, the operation
|
|
|
|
will fail with an :exc:`OSError` subclass in a number of cases:
|
|
|
|
|
|
|
|
On Windows, if *dst* exists a :exc:`FileExistsError` is always raised.
|
2023-01-09 17:43:09 -04:00
|
|
|
The operation may fail if *src* and *dst* are on different filesystems. Use
|
|
|
|
:func:`shutil.move` to support moves to a different filesystem.
|
2019-07-05 05:41:35 -03:00
|
|
|
|
2019-07-11 14:31:19 -03:00
|
|
|
On Unix, if *src* is a file and *dst* is a directory or vice-versa, an
|
2019-07-05 05:41:35 -03:00
|
|
|
:exc:`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised
|
|
|
|
respectively. If both are directories and *dst* is empty, *dst* will be
|
|
|
|
silently replaced. If *dst* is a non-empty directory, an :exc:`OSError`
|
2022-06-01 03:54:31 -03:00
|
|
|
is raised. If both are files, *dst* will be replaced silently if the user
|
2019-07-05 05:41:35 -03:00
|
|
|
has permission. The operation may fail on some Unix flavors if *src* and
|
|
|
|
*dst* are on different filesystems. If successful, the renaming will be an
|
|
|
|
atomic operation (this is a POSIX requirement).
|
2012-01-30 17:08:52 -04:00
|
|
|
|
2012-06-25 03:33:56 -03:00
|
|
|
This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to
|
|
|
|
supply :ref:`paths relative to directory descriptors <dir_fd>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2012-01-30 17:08:52 -04:00
|
|
|
If you want cross-platform overwriting of the destination, use :func:`replace`.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.rename src,dst,src_dir_fd,dst_dir_fd os.rename
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
The *src_dir_fd* and *dst_dir_fd* arguments.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object` for *src* and *dst*.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: renames(old, new)
|
|
|
|
|
|
|
|
Recursive directory or file renaming function. Works like :func:`rename`, except
|
|
|
|
creation of any intermediate directories needed to make the new pathname good is
|
|
|
|
attempted first. After the rename, directories corresponding to rightmost path
|
|
|
|
segments of the old name will be pruned away using :func:`removedirs`.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
This function can fail with the new directory structure made if you lack
|
|
|
|
permissions needed to remove the leaf directory or file.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.rename src,dst,src_dir_fd,dst_dir_fd os.renames
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object` for *old* and *new*.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. function:: replace(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
|
2012-01-30 17:08:52 -04:00
|
|
|
|
2022-04-27 19:03:03 -03:00
|
|
|
Rename the file or directory *src* to *dst*. If *dst* is a non-empty directory,
|
2012-01-30 17:08:52 -04:00
|
|
|
:exc:`OSError` will be raised. If *dst* exists and is a file, it will
|
|
|
|
be replaced silently if the user has permission. The operation may fail
|
|
|
|
if *src* and *dst* are on different filesystems. If successful,
|
|
|
|
the renaming will be an atomic operation (this is a POSIX requirement).
|
|
|
|
|
2012-06-25 03:33:56 -03:00
|
|
|
This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to
|
|
|
|
supply :ref:`paths relative to directory descriptors <dir_fd>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.rename src,dst,src_dir_fd,dst_dir_fd os.replace
|
|
|
|
|
2012-01-30 17:08:52 -04:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object` for *src* and *dst*.
|
|
|
|
|
2012-01-30 17:08:52 -04:00
|
|
|
|
2012-06-23 20:55:07 -03:00
|
|
|
.. function:: rmdir(path, *, dir_fd=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-07-05 05:41:35 -03:00
|
|
|
Remove (delete) the directory *path*. If the directory does not exist or is
|
2021-12-23 05:17:31 -04:00
|
|
|
not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised
|
2019-07-05 05:41:35 -03:00
|
|
|
respectively. In order to remove whole directory trees,
|
|
|
|
:func:`shutil.rmtree` can be used.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support :ref:`paths relative to directory descriptors
|
|
|
|
<dir_fd>`.
|
2012-06-23 20:55:07 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.rmdir path,dir_fd os.rmdir
|
|
|
|
|
2012-06-23 20:55:07 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
The *dir_fd* parameter.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-03-07 20:58:04 -04:00
|
|
|
.. function:: scandir(path='.')
|
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
Return an iterator of :class:`os.DirEntry` objects corresponding to the
|
|
|
|
entries in the directory given by *path*. The entries are yielded in
|
|
|
|
arbitrary order, and the special entries ``'.'`` and ``'..'`` are not
|
2020-09-04 15:19:30 -03:00
|
|
|
included. If a file is removed from or added to the directory after
|
|
|
|
creating the iterator, whether an entry for that file be included is
|
|
|
|
unspecified.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2015-05-15 04:12:58 -03:00
|
|
|
Using :func:`scandir` instead of :func:`listdir` can significantly
|
|
|
|
increase the performance of code that also needs file type or file
|
2016-06-24 18:14:44 -03:00
|
|
|
attribute information, because :class:`os.DirEntry` objects expose this
|
2015-05-15 04:12:58 -03:00
|
|
|
information if the operating system provides it when scanning a directory.
|
2016-06-24 18:14:44 -03:00
|
|
|
All :class:`os.DirEntry` methods may perform a system call, but
|
|
|
|
:func:`~os.DirEntry.is_dir` and :func:`~os.DirEntry.is_file` usually only
|
|
|
|
require a system call for symbolic links; :func:`os.DirEntry.stat`
|
2015-05-15 04:12:58 -03:00
|
|
|
always requires a system call on Unix but only requires one for
|
|
|
|
symbolic links on Windows.
|
|
|
|
|
2016-11-20 02:23:07 -04:00
|
|
|
*path* may be a :term:`path-like object`. If *path* is of type ``bytes``
|
|
|
|
(directly or indirectly through the :class:`PathLike` interface),
|
|
|
|
the type of the :attr:`~os.DirEntry.name` and :attr:`~os.DirEntry.path`
|
|
|
|
attributes of each :class:`os.DirEntry` will be ``bytes``; in all other
|
|
|
|
circumstances, they will be of type ``str``.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2017-03-30 03:12:31 -03:00
|
|
|
This function can also support :ref:`specifying a file descriptor
|
|
|
|
<path_fd>`; the file descriptor must refer to a directory.
|
|
|
|
|
2019-06-27 14:47:59 -03:00
|
|
|
.. audit-event:: os.scandir path os.scandir
|
2019-06-24 12:42:54 -03:00
|
|
|
|
2016-02-11 07:21:30 -04:00
|
|
|
The :func:`scandir` iterator supports the :term:`context manager` protocol
|
|
|
|
and has the following method:
|
|
|
|
|
|
|
|
.. method:: scandir.close()
|
|
|
|
|
|
|
|
Close the iterator and free acquired resources.
|
|
|
|
|
|
|
|
This is called automatically when the iterator is exhausted or garbage
|
|
|
|
collected, or when an error happens during iterating. However it
|
|
|
|
is advisable to call it explicitly or use the :keyword:`with`
|
|
|
|
statement.
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
|
2015-03-07 20:58:04 -04:00
|
|
|
The following example shows a simple use of :func:`scandir` to display all
|
2015-05-15 04:12:58 -03:00
|
|
|
the files (excluding directories) in the given *path* that don't start with
|
|
|
|
``'.'``. The ``entry.is_file()`` call will generally not make an additional
|
|
|
|
system call::
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-02-11 07:21:30 -04:00
|
|
|
with os.scandir(path) as it:
|
|
|
|
for entry in it:
|
|
|
|
if not entry.name.startswith('.') and entry.is_file():
|
|
|
|
print(entry.name)
|
2015-03-07 20:58:04 -04:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
On Unix-based systems, :func:`scandir` uses the system's
|
2022-08-04 04:13:49 -03:00
|
|
|
`opendir() <https://pubs.opengroup.org/onlinepubs/009695399/functions/opendir.html>`_
|
2015-03-07 20:58:04 -04:00
|
|
|
and
|
2022-08-04 04:13:49 -03:00
|
|
|
`readdir() <https://pubs.opengroup.org/onlinepubs/009695399/functions/readdir_r.html>`_
|
2015-03-07 20:58:04 -04:00
|
|
|
functions. On Windows, it uses the Win32
|
2016-02-26 14:37:12 -04:00
|
|
|
`FindFirstFileW <https://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx>`_
|
2015-03-07 20:58:04 -04:00
|
|
|
and
|
2016-02-26 14:37:12 -04:00
|
|
|
`FindNextFileW <https://msdn.microsoft.com/en-us/library/windows/desktop/aa364428(v=vs.85).aspx>`_
|
2015-03-07 20:58:04 -04:00
|
|
|
functions.
|
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2016-02-11 07:21:30 -04:00
|
|
|
.. versionadded:: 3.6
|
|
|
|
Added support for the :term:`context manager` protocol and the
|
|
|
|
:func:`~scandir.close()` method. If a :func:`scandir` iterator is neither
|
|
|
|
exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted
|
|
|
|
in its destructor.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
The function accepts a :term:`path-like object`.
|
|
|
|
|
2017-03-30 03:12:31 -03:00
|
|
|
.. versionchanged:: 3.7
|
|
|
|
Added support for :ref:`file descriptors <path_fd>` on Unix.
|
|
|
|
|
2015-03-07 20:58:04 -04:00
|
|
|
|
|
|
|
.. class:: DirEntry
|
|
|
|
|
|
|
|
Object yielded by :func:`scandir` to expose the file path and other file
|
|
|
|
attributes of a directory entry.
|
|
|
|
|
|
|
|
:func:`scandir` will provide as much of this information as possible without
|
|
|
|
making additional system calls. When a ``stat()`` or ``lstat()`` system call
|
2016-06-24 18:14:44 -03:00
|
|
|
is made, the ``os.DirEntry`` object will cache the result.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
``os.DirEntry`` instances are not intended to be stored in long-lived data
|
2015-03-07 20:58:04 -04:00
|
|
|
structures; if you know the file metadata has changed or if a long time has
|
|
|
|
elapsed since calling :func:`scandir`, call ``os.stat(entry.path)`` to fetch
|
|
|
|
up-to-date information.
|
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
Because the ``os.DirEntry`` methods can make operating system calls, they may
|
2015-05-15 04:12:58 -03:00
|
|
|
also raise :exc:`OSError`. If you need very fine-grained
|
2015-03-07 20:58:04 -04:00
|
|
|
control over errors, you can catch :exc:`OSError` when calling one of the
|
2016-06-24 18:14:44 -03:00
|
|
|
``os.DirEntry`` methods and handle as appropriate.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
To be directly usable as a :term:`path-like object`, ``os.DirEntry``
|
2016-09-06 19:55:02 -03:00
|
|
|
implements the :class:`PathLike` interface.
|
2016-06-10 18:37:21 -03:00
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
Attributes and methods on a ``os.DirEntry`` instance are as follows:
|
2015-03-07 20:58:04 -04:00
|
|
|
|
|
|
|
.. attribute:: name
|
|
|
|
|
|
|
|
The entry's base filename, relative to the :func:`scandir` *path*
|
|
|
|
argument.
|
|
|
|
|
2016-11-20 02:23:07 -04:00
|
|
|
The :attr:`name` attribute will be ``bytes`` if the :func:`scandir`
|
|
|
|
*path* argument is of type ``bytes`` and ``str`` otherwise. Use
|
2015-05-15 04:12:58 -03:00
|
|
|
:func:`~os.fsdecode` to decode byte filenames.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
|
|
|
.. attribute:: path
|
|
|
|
|
|
|
|
The entry's full path name: equivalent to ``os.path.join(scandir_path,
|
|
|
|
entry.name)`` where *scandir_path* is the :func:`scandir` *path*
|
|
|
|
argument. The path is only absolute if the :func:`scandir` *path*
|
2017-03-30 03:12:31 -03:00
|
|
|
argument was absolute. If the :func:`scandir` *path*
|
|
|
|
argument was a :ref:`file descriptor <path_fd>`, the :attr:`path`
|
|
|
|
attribute is the same as the :attr:`name` attribute.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-11-20 02:23:07 -04:00
|
|
|
The :attr:`path` attribute will be ``bytes`` if the :func:`scandir`
|
|
|
|
*path* argument is of type ``bytes`` and ``str`` otherwise. Use
|
2015-05-15 04:12:58 -03:00
|
|
|
:func:`~os.fsdecode` to decode byte filenames.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
|
|
|
.. method:: inode()
|
|
|
|
|
|
|
|
Return the inode number of the entry.
|
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
The result is cached on the ``os.DirEntry`` object. Use
|
|
|
|
``os.stat(entry.path, follow_symlinks=False).st_ino`` to fetch up-to-date
|
|
|
|
information.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-01-31 13:36:41 -04:00
|
|
|
On the first, uncached call, a system call is required on Windows but
|
|
|
|
not on Unix.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2020-12-16 21:37:28 -04:00
|
|
|
.. method:: is_dir(*, follow_symlinks=True)
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-01-31 13:36:41 -04:00
|
|
|
Return ``True`` if this entry is a directory or a symbolic link pointing
|
|
|
|
to a directory; return ``False`` if the entry is or points to any other
|
|
|
|
kind of file, or if it doesn't exist anymore.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
|
|
|
If *follow_symlinks* is ``False``, return ``True`` only if this entry
|
2016-01-31 13:36:41 -04:00
|
|
|
is a directory (without following symlinks); return ``False`` if the
|
|
|
|
entry is any other kind of file or if it doesn't exist anymore.
|
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
The result is cached on the ``os.DirEntry`` object, with a separate cache
|
2016-01-31 13:36:41 -04:00
|
|
|
for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along
|
|
|
|
with :func:`stat.S_ISDIR` to fetch up-to-date information.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-01-31 13:36:41 -04:00
|
|
|
On the first, uncached call, no system call is required in most cases.
|
|
|
|
Specifically, for non-symlinks, neither Windows or Unix require a system
|
|
|
|
call, except on certain Unix file systems, such as network file systems,
|
|
|
|
that return ``dirent.d_type == DT_UNKNOWN``. If the entry is a symlink,
|
|
|
|
a system call will be required to follow the symlink unless
|
|
|
|
*follow_symlinks* is ``False``.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2015-05-15 04:12:58 -03:00
|
|
|
This method can raise :exc:`OSError`, such as :exc:`PermissionError`,
|
|
|
|
but :exc:`FileNotFoundError` is caught and not raised.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2020-12-16 21:37:28 -04:00
|
|
|
.. method:: is_file(*, follow_symlinks=True)
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-01-31 13:36:41 -04:00
|
|
|
Return ``True`` if this entry is a file or a symbolic link pointing to a
|
|
|
|
file; return ``False`` if the entry is or points to a directory or other
|
|
|
|
non-file entry, or if it doesn't exist anymore.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
|
|
|
If *follow_symlinks* is ``False``, return ``True`` only if this entry
|
2016-01-31 13:36:41 -04:00
|
|
|
is a file (without following symlinks); return ``False`` if the entry is
|
|
|
|
a directory or other non-file entry, or if it doesn't exist anymore.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
The result is cached on the ``os.DirEntry`` object. Caching, system calls
|
|
|
|
made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
|
|
|
.. method:: is_symlink()
|
|
|
|
|
2015-05-15 04:12:58 -03:00
|
|
|
Return ``True`` if this entry is a symbolic link (even if broken);
|
2016-01-31 13:36:41 -04:00
|
|
|
return ``False`` if the entry points to a directory or any kind of file,
|
2015-05-15 04:12:58 -03:00
|
|
|
or if it doesn't exist anymore.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
The result is cached on the ``os.DirEntry`` object. Call
|
2015-05-15 04:12:58 -03:00
|
|
|
:func:`os.path.islink` to fetch up-to-date information.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-01-31 13:36:41 -04:00
|
|
|
On the first, uncached call, no system call is required in most cases.
|
|
|
|
Specifically, neither Windows or Unix require a system call, except on
|
|
|
|
certain Unix file systems, such as network file systems, that return
|
|
|
|
``dirent.d_type == DT_UNKNOWN``.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-01-31 13:36:41 -04:00
|
|
|
This method can raise :exc:`OSError`, such as :exc:`PermissionError`,
|
|
|
|
but :exc:`FileNotFoundError` is caught and not raised.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2022-11-22 13:19:34 -04:00
|
|
|
.. method:: is_junction()
|
|
|
|
|
|
|
|
Return ``True`` if this entry is a junction (even if broken);
|
|
|
|
return ``False`` if the entry points to a regular directory, any kind
|
|
|
|
of file, a symlink, or if it doesn't exist anymore.
|
|
|
|
|
|
|
|
The result is cached on the ``os.DirEntry`` object. Call
|
|
|
|
:func:`os.path.isjunction` to fetch up-to-date information.
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
2020-12-16 21:37:28 -04:00
|
|
|
.. method:: stat(*, follow_symlinks=True)
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2015-05-15 04:12:58 -03:00
|
|
|
Return a :class:`stat_result` object for this entry. This method
|
|
|
|
follows symbolic links by default; to stat a symbolic link add the
|
|
|
|
``follow_symlinks=False`` argument.
|
|
|
|
|
2016-01-31 13:36:41 -04:00
|
|
|
On Unix, this method always requires a system call. On Windows, it
|
|
|
|
only requires a system call if *follow_symlinks* is ``True`` and the
|
2019-08-21 19:27:33 -03:00
|
|
|
entry is a reparse point (for example, a symbolic link or directory
|
|
|
|
junction).
|
2015-03-07 20:58:04 -04:00
|
|
|
|
|
|
|
On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the
|
|
|
|
:class:`stat_result` are always set to zero. Call :func:`os.stat` to
|
|
|
|
get these attributes.
|
|
|
|
|
2016-06-24 18:14:44 -03:00
|
|
|
The result is cached on the ``os.DirEntry`` object, with a separate cache
|
2016-01-31 13:36:41 -04:00
|
|
|
for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to
|
|
|
|
fetch up-to-date information.
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2016-01-06 15:36:03 -04:00
|
|
|
Note that there is a nice correspondence between several attributes
|
2016-06-24 18:14:44 -03:00
|
|
|
and methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In
|
2016-06-24 16:21:47 -03:00
|
|
|
particular, the ``name`` attribute has the same
|
2022-11-22 13:19:34 -04:00
|
|
|
meaning, as do the ``is_dir()``, ``is_file()``, ``is_symlink()``,
|
|
|
|
``is_junction()``, and ``stat()`` methods.
|
2016-01-06 15:36:03 -04:00
|
|
|
|
2015-03-07 20:58:04 -04:00
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
2016-06-10 18:37:21 -03:00
|
|
|
.. versionchanged:: 3.6
|
2016-11-20 02:23:07 -04:00
|
|
|
Added support for the :class:`~os.PathLike` interface. Added support
|
|
|
|
for :class:`bytes` paths on Windows.
|
2016-06-10 18:37:21 -03:00
|
|
|
|
2023-03-16 14:27:21 -03:00
|
|
|
.. versionchanged:: 3.12
|
|
|
|
The ``st_ctime`` attribute of a stat result is deprecated on Windows.
|
|
|
|
The file creation time is properly available as ``st_birthtime``, and
|
|
|
|
in the future ``st_ctime`` may be changed to return zero or the
|
|
|
|
metadata change time, if available.
|
|
|
|
|
2015-03-07 20:58:04 -04:00
|
|
|
|
2020-12-16 21:37:28 -04:00
|
|
|
.. function:: stat(path, *, dir_fd=None, follow_symlinks=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
Get the status of a file or a file descriptor. Perform the equivalent of a
|
|
|
|
:c:func:`stat` system call on the given path. *path* may be specified as
|
2017-01-22 01:04:17 -04:00
|
|
|
either a string or bytes -- directly or indirectly through the :class:`PathLike`
|
2016-09-06 19:55:02 -03:00
|
|
|
interface -- or as an open file descriptor. Return a :class:`stat_result`
|
2014-07-24 07:42:16 -03:00
|
|
|
object.
|
2011-01-24 15:34:58 -04:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
This function normally follows symlinks; to stat a symlink add the argument
|
|
|
|
``follow_symlinks=False``, or use :func:`lstat`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>` and
|
|
|
|
:ref:`not following symlinks <follow_symlinks>`.
|
2011-01-24 15:34:58 -04:00
|
|
|
|
2019-08-21 19:27:33 -03:00
|
|
|
On Windows, passing ``follow_symlinks=False`` will disable following all
|
|
|
|
name-surrogate reparse points, which includes symlinks and directory
|
|
|
|
junctions. Other types of reparse points that do not resemble links or that
|
|
|
|
the operating system is unable to follow will be opened directly. When
|
|
|
|
following a chain of multiple links, this may result in the original link
|
|
|
|
being returned instead of the non-link that prevented full traversal. To
|
|
|
|
obtain stat results for the final path in this case, use the
|
|
|
|
:func:`os.path.realpath` function to resolve the path name as far as
|
|
|
|
possible and call :func:`lstat` on the result. This does not apply to
|
|
|
|
dangling symlinks or junction points, which will raise the usual exceptions.
|
|
|
|
|
2023-05-04 05:17:12 -03:00
|
|
|
.. index:: pair: module; stat
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
Example::
|
|
|
|
|
|
|
|
>>> import os
|
|
|
|
>>> statinfo = os.stat('somefile.txt')
|
|
|
|
>>> statinfo
|
|
|
|
os.stat_result(st_mode=33188, st_ino=7876932, st_dev=234881026,
|
|
|
|
st_nlink=1, st_uid=501, st_gid=501, st_size=264, st_atime=1297230295,
|
|
|
|
st_mtime=1297230027, st_ctime=1297230027)
|
|
|
|
>>> statinfo.st_size
|
|
|
|
264
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
:func:`fstat` and :func:`lstat` functions.
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
Added the *dir_fd* and *follow_symlinks* arguments, specifying a file
|
|
|
|
descriptor instead of a path.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2019-08-21 19:27:33 -03:00
|
|
|
.. versionchanged:: 3.8
|
|
|
|
On Windows, all reparse points that can be resolved by the operating
|
|
|
|
system are now followed, and passing ``follow_symlinks=False``
|
|
|
|
disables following all name surrogate reparse points. If the operating
|
|
|
|
system reaches a reparse point that it is not able to follow, *stat* now
|
|
|
|
returns the information for the original path as if
|
|
|
|
``follow_symlinks=False`` had been specified instead of raising an error.
|
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
|
|
|
|
.. class:: stat_result
|
|
|
|
|
|
|
|
Object whose attributes correspond roughly to the members of the
|
2023-07-26 16:29:23 -03:00
|
|
|
:c:struct:`stat` structure. It is used for the result of :func:`os.stat`,
|
2014-07-24 07:42:16 -03:00
|
|
|
:func:`os.fstat` and :func:`os.lstat`.
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
|
|
|
|
.. attribute:: st_mode
|
|
|
|
|
|
|
|
File mode: file type and file mode bits (permissions).
|
|
|
|
|
|
|
|
.. attribute:: st_ino
|
|
|
|
|
2018-05-28 21:24:36 -03:00
|
|
|
Platform dependent, but if non-zero, uniquely identifies the
|
|
|
|
file for a given value of ``st_dev``. Typically:
|
|
|
|
|
|
|
|
* the inode number on Unix,
|
|
|
|
* the `file index
|
|
|
|
<https://msdn.microsoft.com/en-us/library/aa363788>`_ on
|
|
|
|
Windows
|
2014-07-24 07:42:16 -03:00
|
|
|
|
|
|
|
.. attribute:: st_dev
|
|
|
|
|
|
|
|
Identifier of the device on which this file resides.
|
|
|
|
|
|
|
|
.. attribute:: st_nlink
|
|
|
|
|
|
|
|
Number of hard links.
|
|
|
|
|
|
|
|
.. attribute:: st_uid
|
|
|
|
|
|
|
|
User identifier of the file owner.
|
|
|
|
|
|
|
|
.. attribute:: st_gid
|
|
|
|
|
|
|
|
Group identifier of the file owner.
|
|
|
|
|
|
|
|
.. attribute:: st_size
|
|
|
|
|
|
|
|
Size of the file in bytes, if it is a regular file or a symbolic link.
|
|
|
|
The size of a symbolic link is the length of the pathname it contains,
|
|
|
|
without a terminating null byte.
|
|
|
|
|
|
|
|
Timestamps:
|
|
|
|
|
|
|
|
.. attribute:: st_atime
|
|
|
|
|
|
|
|
Time of most recent access expressed in seconds.
|
2011-01-24 15:34:58 -04:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
.. attribute:: st_mtime
|
|
|
|
|
|
|
|
Time of most recent content modification expressed in seconds.
|
|
|
|
|
|
|
|
.. attribute:: st_ctime
|
2014-06-19 11:46:37 -03:00
|
|
|
|
2023-03-16 14:27:21 -03:00
|
|
|
Time of most recent metadata change expressed in seconds.
|
2014-07-24 07:42:16 -03:00
|
|
|
|
2023-03-16 14:27:21 -03:00
|
|
|
.. versionchanged:: 3.12
|
|
|
|
``st_ctime`` is deprecated on Windows. Use ``st_birthtime`` for
|
|
|
|
the file creation time. In the future, ``st_ctime`` will contain
|
|
|
|
the time of the most recent metadata change, as for other platforms.
|
2014-07-24 07:42:16 -03:00
|
|
|
|
|
|
|
.. attribute:: st_atime_ns
|
|
|
|
|
|
|
|
Time of most recent access expressed in nanoseconds as an integer.
|
|
|
|
|
|
|
|
.. attribute:: st_mtime_ns
|
|
|
|
|
|
|
|
Time of most recent content modification expressed in nanoseconds as an
|
|
|
|
integer.
|
|
|
|
|
|
|
|
.. attribute:: st_ctime_ns
|
|
|
|
|
2023-03-16 14:27:21 -03:00
|
|
|
Time of most recent metadata change expressed in nanoseconds as an
|
|
|
|
integer.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.12
|
|
|
|
``st_ctime_ns`` is deprecated on Windows. Use ``st_birthtime_ns``
|
|
|
|
for the file creation time. In the future, ``st_ctime`` will contain
|
|
|
|
the time of the most recent metadata change, as for other platforms.
|
|
|
|
|
|
|
|
.. attribute:: st_birthtime
|
|
|
|
|
|
|
|
Time of file creation expressed in seconds. This attribute is not
|
|
|
|
always available, and may raise :exc:`AttributeError`.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.12
|
|
|
|
``st_birthtime`` is now available on Windows.
|
|
|
|
|
|
|
|
.. attribute:: st_birthtime_ns
|
2014-07-24 07:42:16 -03:00
|
|
|
|
2023-03-16 14:27:21 -03:00
|
|
|
Time of file creation expressed in nanoseconds as an integer.
|
|
|
|
This attribute is not always available, and may raise
|
|
|
|
:exc:`AttributeError`.
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
2014-07-24 07:42:16 -03:00
|
|
|
|
2011-01-24 15:34:58 -04:00
|
|
|
.. note::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-07-04 15:43:51 -03:00
|
|
|
The exact meaning and resolution of the :attr:`st_atime`,
|
2023-03-16 14:27:21 -03:00
|
|
|
:attr:`st_mtime`, :attr:`st_ctime` and :attr:`st_birthtime` attributes
|
|
|
|
depend on the operating system and the file system. For example, on
|
|
|
|
Windows systems using the FAT32 file systems, :attr:`st_mtime` has
|
|
|
|
2-second resolution, and :attr:`st_atime` has only 1-day resolution.
|
|
|
|
See your operating system documentation for details.
|
2014-07-24 07:42:16 -03:00
|
|
|
|
2012-04-19 19:07:49 -03:00
|
|
|
Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`,
|
2023-03-16 14:27:21 -03:00
|
|
|
:attr:`st_ctime_ns` and :attr:`st_birthtime_ns` are always expressed in
|
|
|
|
nanoseconds, many systems do not provide nanosecond precision. On
|
|
|
|
systems that do provide nanosecond precision, the floating-point object
|
|
|
|
used to store :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime` and
|
|
|
|
:attr:`st_birthtime` cannot preserve all of it, and as such will be
|
|
|
|
slightly inexact. If you need the exact timestamps you should always use
|
|
|
|
:attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:`st_ctime_ns` and
|
|
|
|
:attr:`st_birthtime_ns`.
|
2011-01-24 15:34:58 -04:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
On some Unix systems (such as Linux), the following attributes may also be
|
|
|
|
available:
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
.. attribute:: st_blocks
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
Number of 512-byte blocks allocated for file.
|
|
|
|
This may be smaller than :attr:`st_size`/512 when the file has holes.
|
2011-01-24 15:34:58 -04:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
.. attribute:: st_blksize
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
"Preferred" blocksize for efficient file system I/O. Writing to a file in
|
|
|
|
smaller chunks may cause an inefficient read-modify-rewrite.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
.. attribute:: st_rdev
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
Type of device if an inode device.
|
|
|
|
|
|
|
|
.. attribute:: st_flags
|
|
|
|
|
|
|
|
User defined flags for file.
|
|
|
|
|
|
|
|
On other Unix systems (such as FreeBSD), the following attributes may be
|
|
|
|
available (but may be only filled out if root tries to use them):
|
|
|
|
|
|
|
|
.. attribute:: st_gen
|
|
|
|
|
|
|
|
File generation number.
|
|
|
|
|
2018-01-28 09:00:08 -04:00
|
|
|
On Solaris and derivatives, the following attributes may also be
|
|
|
|
available:
|
|
|
|
|
|
|
|
.. attribute:: st_fstype
|
|
|
|
|
|
|
|
String that uniquely identifies the type of the filesystem that
|
|
|
|
contains the file.
|
|
|
|
|
2021-09-22 14:33:36 -03:00
|
|
|
On macOS systems, the following attributes may also be available:
|
2014-07-24 07:42:16 -03:00
|
|
|
|
|
|
|
.. attribute:: st_rsize
|
|
|
|
|
|
|
|
Real size of the file.
|
|
|
|
|
|
|
|
.. attribute:: st_creator
|
|
|
|
|
|
|
|
Creator of the file.
|
|
|
|
|
|
|
|
.. attribute:: st_type
|
|
|
|
|
|
|
|
File type.
|
|
|
|
|
2019-08-21 19:27:33 -03:00
|
|
|
On Windows systems, the following attributes are also available:
|
2014-07-24 07:44:07 -03:00
|
|
|
|
|
|
|
.. attribute:: st_file_attributes
|
|
|
|
|
|
|
|
Windows file attributes: ``dwFileAttributes`` member of the
|
|
|
|
``BY_HANDLE_FILE_INFORMATION`` structure returned by
|
2023-08-19 14:03:26 -03:00
|
|
|
:c:func:`!GetFileInformationByHandle`.
|
|
|
|
See the :const:`!FILE_ATTRIBUTE_* <stat.FILE_ATTRIBUTE_ARCHIVE>`
|
2014-07-24 07:44:07 -03:00
|
|
|
constants in the :mod:`stat` module.
|
|
|
|
|
2019-08-21 19:27:33 -03:00
|
|
|
.. attribute:: st_reparse_tag
|
|
|
|
|
2023-08-19 14:03:26 -03:00
|
|
|
When :attr:`st_file_attributes` has the :const:`~stat.FILE_ATTRIBUTE_REPARSE_POINT`
|
2019-08-21 19:27:33 -03:00
|
|
|
set, this field contains the tag identifying the type of reparse point.
|
2023-08-19 14:03:26 -03:00
|
|
|
See the :const:`IO_REPARSE_TAG_* <stat.IO_REPARSE_TAG_SYMLINK>`
|
|
|
|
constants in the :mod:`stat` module.
|
2019-08-21 19:27:33 -03:00
|
|
|
|
2014-07-24 07:42:16 -03:00
|
|
|
The standard module :mod:`stat` defines functions and constants that are
|
2023-07-26 16:29:23 -03:00
|
|
|
useful for extracting information from a :c:struct:`stat` structure. (On
|
2014-07-24 07:42:16 -03:00
|
|
|
Windows, some items are filled with dummy values.)
|
|
|
|
|
|
|
|
For backward compatibility, a :class:`stat_result` instance is also
|
|
|
|
accessible as a tuple of at least 10 integers giving the most important (and
|
2023-07-26 16:29:23 -03:00
|
|
|
portable) members of the :c:struct:`stat` structure, in the order
|
2014-07-24 07:42:16 -03:00
|
|
|
:attr:`st_mode`, :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`,
|
|
|
|
:attr:`st_uid`, :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`,
|
|
|
|
:attr:`st_mtime`, :attr:`st_ctime`. More items may be added at the end by
|
|
|
|
some implementations. For compatibility with older Python versions,
|
|
|
|
accessing :class:`stat_result` as a tuple always returns integers.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-04-19 19:07:49 -03:00
|
|
|
.. versionadded:: 3.3
|
2014-07-24 07:42:16 -03:00
|
|
|
Added the :attr:`st_atime_ns`, :attr:`st_mtime_ns`, and
|
|
|
|
:attr:`st_ctime_ns` members.
|
2012-04-19 19:07:49 -03:00
|
|
|
|
2014-06-19 11:46:37 -03:00
|
|
|
.. versionadded:: 3.5
|
|
|
|
Added the :attr:`st_file_attributes` member on Windows.
|
|
|
|
|
2018-05-28 21:24:36 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
Windows now returns the file index as :attr:`st_ino` when
|
|
|
|
available.
|
|
|
|
|
2018-01-28 09:00:08 -04:00
|
|
|
.. versionadded:: 3.7
|
|
|
|
Added the :attr:`st_fstype` member to Solaris/derivatives.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-08-21 19:27:33 -03:00
|
|
|
.. versionadded:: 3.8
|
|
|
|
Added the :attr:`st_reparse_tag` member on Windows.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.8
|
|
|
|
On Windows, the :attr:`st_mode` member now identifies special
|
|
|
|
files as :const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK`
|
|
|
|
as appropriate.
|
|
|
|
|
2023-03-16 14:27:21 -03:00
|
|
|
.. versionchanged:: 3.12
|
|
|
|
On Windows, :attr:`st_ctime` is deprecated. Eventually, it will
|
|
|
|
contain the last metadata change time, for consistency with other
|
|
|
|
platforms, but for now still contains creation time.
|
|
|
|
Use :attr:`st_birthtime` for the creation time.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.12
|
|
|
|
On Windows, :attr:`st_ino` may now be up to 128 bits, depending
|
|
|
|
on the file system. Previously it would not be above 64 bits, and
|
|
|
|
larger file identifiers would be arbitrarily packed.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.12
|
|
|
|
On Windows, :attr:`st_rdev` no longer returns a value. Previously
|
|
|
|
it would contain the same as :attr:`st_dev`, which was incorrect.
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
Added the :attr:`st_birthtime` member on Windows.
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: statvfs(path)
|
|
|
|
|
2023-08-19 14:03:26 -03:00
|
|
|
Perform a :c:func:`!statvfs` system call on the given path. The return value is
|
2007-08-15 11:28:22 -03:00
|
|
|
an object whose attributes describe the filesystem on the given path, and
|
2023-07-26 16:29:23 -03:00
|
|
|
correspond to the members of the :c:struct:`statvfs` structure, namely:
|
2007-08-15 11:28:22 -03:00
|
|
|
:attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`,
|
|
|
|
:attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`,
|
2017-12-14 18:46:46 -04:00
|
|
|
:attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2010-08-18 19:30:34 -03:00
|
|
|
Two module-level constants are defined for the :attr:`f_flag` attribute's
|
|
|
|
bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted
|
|
|
|
read-only, and if :const:`ST_NOSUID` is set, the semantics of
|
|
|
|
setuid/setgid bits are disabled or not supported.
|
|
|
|
|
2013-12-08 10:23:07 -04:00
|
|
|
Additional module-level constants are defined for GNU/glibc based systems.
|
|
|
|
These are :const:`ST_NODEV` (disallow access to device special files),
|
|
|
|
:const:`ST_NOEXEC` (disallow program execution), :const:`ST_SYNCHRONOUS`
|
|
|
|
(writes are synced at once), :const:`ST_MANDLOCK` (allow mandatory locks on an FS),
|
|
|
|
:const:`ST_WRITE` (write on file/directory/symlink), :const:`ST_APPEND`
|
|
|
|
(append-only file), :const:`ST_IMMUTABLE` (immutable file), :const:`ST_NOATIME`
|
|
|
|
(do not update access times), :const:`ST_NODIRATIME` (do not update directory access
|
|
|
|
times), :const:`ST_RELATIME` (update atime relative to mtime/ctime).
|
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2016-09-06 19:55:02 -03:00
|
|
|
|
2010-08-18 19:30:34 -03:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionadded:: 3.3
|
2019-05-06 09:39:13 -03:00
|
|
|
Added support for specifying *path* as an open file descriptor.
|
2016-09-06 19:55:02 -03:00
|
|
|
|
2013-12-08 10:23:07 -04:00
|
|
|
.. versionchanged:: 3.4
|
|
|
|
The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`,
|
|
|
|
:const:`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`,
|
|
|
|
:const:`ST_IMMUTABLE`, :const:`ST_NOATIME`, :const:`ST_NODIRATIME`,
|
|
|
|
and :const:`ST_RELATIME` constants were added.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2017-12-14 18:46:46 -04:00
|
|
|
.. versionadded:: 3.7
|
|
|
|
Added :attr:`f_fsid`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. data:: supports_dir_fd
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
A :class:`set` object indicating which functions in the :mod:`os`
|
|
|
|
module accept an open file descriptor for their *dir_fd* parameter.
|
|
|
|
Different platforms provide different features, and the underlying
|
|
|
|
functionality Python uses to implement the *dir_fd* parameter is not
|
|
|
|
available on all platforms Python supports. For consistency's sake,
|
|
|
|
functions that may support *dir_fd* always allow specifying the
|
|
|
|
parameter, but will throw an exception if the functionality is used
|
|
|
|
when it's not locally available. (Specifying ``None`` for *dir_fd*
|
|
|
|
is always supported on all platforms.)
|
|
|
|
|
|
|
|
To check whether a particular function accepts an open file descriptor
|
|
|
|
for its *dir_fd* parameter, use the ``in`` operator on ``supports_dir_fd``.
|
|
|
|
As an example, this expression evaluates to ``True`` if :func:`os.stat`
|
|
|
|
accepts open file descriptors for *dir_fd* on the local platform::
|
2012-06-22 20:30:09 -03:00
|
|
|
|
|
|
|
os.stat in os.supports_dir_fd
|
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
Currently *dir_fd* parameters only work on Unix platforms;
|
|
|
|
none of them work on Windows.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. data:: supports_effective_ids
|
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
A :class:`set` object indicating whether :func:`os.access` permits
|
|
|
|
specifying ``True`` for its *effective_ids* parameter on the local platform.
|
|
|
|
(Specifying ``False`` for *effective_ids* is always supported on all
|
|
|
|
platforms.) If the local platform supports it, the collection will contain
|
|
|
|
:func:`os.access`; otherwise it will be empty.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
This expression evaluates to ``True`` if :func:`os.access` supports
|
|
|
|
``effective_ids=True`` on the local platform::
|
2012-06-22 20:30:09 -03:00
|
|
|
|
|
|
|
os.access in os.supports_effective_ids
|
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
Currently *effective_ids* is only supported on Unix platforms;
|
|
|
|
it does not work on Windows.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. data:: supports_fd
|
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
A :class:`set` object indicating which functions in the
|
2012-06-25 03:33:56 -03:00
|
|
|
:mod:`os` module permit specifying their *path* parameter as an open file
|
2019-05-06 09:39:13 -03:00
|
|
|
descriptor on the local platform. Different platforms provide different
|
|
|
|
features, and the underlying functionality Python uses to accept open file
|
|
|
|
descriptors as *path* arguments is not available on all platforms Python
|
|
|
|
supports.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
To determine whether a particular function permits specifying an open file
|
2012-06-22 20:30:09 -03:00
|
|
|
descriptor for its *path* parameter, use the ``in`` operator on
|
2019-05-06 09:39:13 -03:00
|
|
|
``supports_fd``. As an example, this expression evaluates to ``True`` if
|
|
|
|
:func:`os.chdir` accepts open file descriptors for *path* on your local
|
2012-06-22 20:30:09 -03:00
|
|
|
platform::
|
|
|
|
|
|
|
|
os.chdir in os.supports_fd
|
2010-07-09 12:15:09 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. data:: supports_follow_symlinks
|
|
|
|
|
2019-05-06 09:39:13 -03:00
|
|
|
A :class:`set` object indicating which functions in the :mod:`os` module
|
|
|
|
accept ``False`` for their *follow_symlinks* parameter on the local platform.
|
|
|
|
Different platforms provide different features, and the underlying
|
|
|
|
functionality Python uses to implement *follow_symlinks* is not available
|
|
|
|
on all platforms Python supports. For consistency's sake, functions that
|
|
|
|
may support *follow_symlinks* always allow specifying the parameter, but
|
|
|
|
will throw an exception if the functionality is used when it's not locally
|
|
|
|
available. (Specifying ``True`` for *follow_symlinks* is always supported
|
|
|
|
on all platforms.)
|
|
|
|
|
|
|
|
To check whether a particular function accepts ``False`` for its
|
|
|
|
*follow_symlinks* parameter, use the ``in`` operator on
|
|
|
|
``supports_follow_symlinks``. As an example, this expression evaluates
|
|
|
|
to ``True`` if you may specify ``follow_symlinks=False`` when calling
|
|
|
|
:func:`os.stat` on the local platform::
|
2012-06-22 20:30:09 -03:00
|
|
|
|
|
|
|
os.stat in os.supports_follow_symlinks
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2012-06-24 07:50:06 -03:00
|
|
|
|
2015-09-08 22:01:13 -03:00
|
|
|
.. function:: symlink(src, dst, target_is_directory=False, *, dir_fd=None)
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2015-09-08 22:01:13 -03:00
|
|
|
Create a symbolic link pointing to *src* named *dst*.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
On Windows, a symlink represents either a file or a directory, and does not
|
2013-05-28 00:21:28 -03:00
|
|
|
morph to the target dynamically. If the target is present, the type of the
|
|
|
|
symlink will be created to match. Otherwise, the symlink will be created
|
|
|
|
as a directory if *target_is_directory* is ``True`` or a file symlink (the
|
2018-11-13 20:13:12 -04:00
|
|
|
default) otherwise. On non-Windows platforms, *target_is_directory* is ignored.
|
2010-07-08 18:39:08 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support :ref:`paths relative to directory descriptors
|
|
|
|
<dir_fd>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2010-12-02 14:29:18 -04:00
|
|
|
.. note::
|
|
|
|
|
2019-04-09 15:19:46 -03:00
|
|
|
On newer versions of Windows 10, unprivileged accounts can create symlinks
|
|
|
|
if Developer Mode is enabled. When Developer Mode is not available/enabled,
|
|
|
|
the *SeCreateSymbolicLinkPrivilege* privilege is required, or the process
|
|
|
|
must be run as an administrator.
|
2010-12-28 13:08:22 -04:00
|
|
|
|
2013-05-28 00:21:28 -03:00
|
|
|
|
2010-12-28 13:08:22 -04:00
|
|
|
:exc:`OSError` is raised when the function is called by an unprivileged
|
|
|
|
user.
|
2010-07-08 18:39:08 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.symlink src,dst,dir_fd os.symlink
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2010-07-09 12:15:09 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
The function is limited on Emscripten and WASI, see
|
|
|
|
:ref:`wasm-availability` for more information.
|
|
|
|
|
2010-07-10 05:58:37 -03:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Added support for Windows 6.0 (Vista) symbolic links.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
|
|
|
Added the *dir_fd* argument, and now allow *target_is_directory*
|
|
|
|
on non-Windows platforms.
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object` for *src* and *dst*.
|
|
|
|
|
2019-04-09 15:19:46 -03:00
|
|
|
.. versionchanged:: 3.8
|
|
|
|
Added support for unelevated symlinks on Windows with Developer Mode.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-03-17 15:20:30 -03:00
|
|
|
.. function:: sync()
|
|
|
|
|
|
|
|
Force write of everything to disk.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: truncate(path, length)
|
|
|
|
|
|
|
|
Truncate the file corresponding to *path*, so that it is at most
|
|
|
|
*length* bytes in size.
|
|
|
|
|
2012-06-24 07:55:33 -03:00
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>`.
|
|
|
|
|
2019-06-27 14:47:59 -03:00
|
|
|
.. audit-event:: os.truncate path,length os.truncate
|
2019-05-23 12:45:22 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2015-03-20 23:50:46 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
Added support for Windows
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
|
|
|
|
2012-06-23 20:55:07 -03:00
|
|
|
.. function:: unlink(path, *, dir_fd=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-12-28 21:28:19 -04:00
|
|
|
Remove (delete) the file *path*. This function is semantically
|
|
|
|
identical to :func:`remove`; the ``unlink`` name is its
|
|
|
|
traditional Unix name. Please see the documentation for
|
|
|
|
:func:`remove` for further information.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.remove path,dir_fd os.unlink
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
2012-06-23 20:55:07 -03:00
|
|
|
The *dir_fd* parameter.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2015-09-08 22:01:13 -03:00
|
|
|
.. function:: utime(path, times=None, *[, ns], dir_fd=None, follow_symlinks=True)
|
2012-05-03 04:30:07 -03:00
|
|
|
|
|
|
|
Set the access and modified times of the file specified by *path*.
|
|
|
|
|
|
|
|
:func:`utime` takes two optional parameters, *times* and *ns*.
|
|
|
|
These specify the times set on *path* and are used as follows:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2015-09-08 22:01:13 -03:00
|
|
|
- If *ns* is specified,
|
2012-05-03 04:30:07 -03:00
|
|
|
it must be a 2-tuple of the form ``(atime_ns, mtime_ns)``
|
|
|
|
where each member is an int expressing nanoseconds.
|
2012-06-22 20:30:09 -03:00
|
|
|
- If *times* is not ``None``,
|
2012-05-03 04:30:07 -03:00
|
|
|
it must be a 2-tuple of the form ``(atime, mtime)``
|
|
|
|
where each member is an int or float expressing seconds.
|
2015-09-08 22:01:13 -03:00
|
|
|
- If *times* is ``None`` and *ns* is unspecified,
|
2012-06-22 20:30:09 -03:00
|
|
|
this is equivalent to specifying ``ns=(atime_ns, mtime_ns)``
|
2012-05-03 04:30:07 -03:00
|
|
|
where both times are the current time.
|
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
It is an error to specify tuples for both *times* and *ns*.
|
2012-05-03 04:30:07 -03:00
|
|
|
|
2018-05-01 07:02:26 -03:00
|
|
|
Note that the exact times you set here may not be returned by a subsequent
|
|
|
|
:func:`~os.stat` call, depending on the resolution with which your operating
|
|
|
|
system records access and modification times; see :func:`~os.stat`. The best
|
|
|
|
way to preserve exact times is to use the *st_atime_ns* and *st_mtime_ns*
|
|
|
|
fields from the :func:`os.stat` result object with the *ns* parameter to
|
2022-10-06 22:01:30 -03:00
|
|
|
:func:`utime`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>`,
|
|
|
|
:ref:`paths relative to directory descriptors <dir_fd>` and :ref:`not
|
|
|
|
following symlinks <follow_symlinks>`.
|
2012-06-22 20:30:09 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.utime path,times,ns,dir_fd os.utime
|
|
|
|
|
2012-05-03 04:30:07 -03:00
|
|
|
.. versionadded:: 3.3
|
2019-05-06 09:39:13 -03:00
|
|
|
Added support for specifying *path* as an open file descriptor,
|
2012-06-22 20:30:09 -03:00
|
|
|
and the *dir_fd*, *follow_symlinks*, and *ns* parameters.
|
2012-05-03 04:30:07 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-09-02 17:34:52 -03:00
|
|
|
.. function:: walk(top, topdown=True, onerror=None, followlinks=False)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. index::
|
|
|
|
single: directory; walking
|
|
|
|
single: directory; traversal
|
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
Generate the file names in a directory tree by walking the tree
|
|
|
|
either top-down or bottom-up. For each directory in the tree rooted at directory
|
2007-08-15 11:28:22 -03:00
|
|
|
*top* (including *top* itself), it yields a 3-tuple ``(dirpath, dirnames,
|
|
|
|
filenames)``.
|
|
|
|
|
|
|
|
*dirpath* is a string, the path to the directory. *dirnames* is a list of the
|
2022-10-07 19:51:50 -03:00
|
|
|
names of the subdirectories in *dirpath* (including symlinks to directories,
|
|
|
|
and excluding ``'.'`` and ``'..'``).
|
2007-08-15 11:28:22 -03:00
|
|
|
*filenames* is a list of the names of the non-directory files in *dirpath*.
|
|
|
|
Note that the names in the lists contain no path components. To get a full path
|
|
|
|
(which begins with *top*) to a file or directory in *dirpath*, do
|
2020-09-04 15:19:30 -03:00
|
|
|
``os.path.join(dirpath, name)``. Whether or not the lists are sorted
|
|
|
|
depends on the file system. If a file is removed from or added to the
|
|
|
|
*dirpath* directory during generating the lists, whether a name for that
|
|
|
|
file be included is unspecified.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
If optional argument *topdown* is ``True`` or not specified, the triple for a
|
2007-08-15 11:28:22 -03:00
|
|
|
directory is generated before the triples for any of its subdirectories
|
2014-06-16 00:51:12 -03:00
|
|
|
(directories are generated top-down). If *topdown* is ``False``, the triple
|
|
|
|
for a directory is generated after the triples for all of its subdirectories
|
|
|
|
(directories are generated bottom-up). No matter the value of *topdown*, the
|
|
|
|
list of subdirectories is retrieved before the tuples for the directory and
|
|
|
|
its subdirectories are generated.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
When *topdown* is ``True``, the caller can modify the *dirnames* list in-place
|
2007-08-15 11:28:22 -03:00
|
|
|
(perhaps using :keyword:`del` or slice assignment), and :func:`walk` will only
|
|
|
|
recurse into the subdirectories whose names remain in *dirnames*; this can be
|
|
|
|
used to prune the search, impose a specific order of visiting, or even to inform
|
|
|
|
:func:`walk` about directories the caller creates or renames before it resumes
|
2015-10-23 07:38:11 -03:00
|
|
|
:func:`walk` again. Modifying *dirnames* when *topdown* is ``False`` has
|
|
|
|
no effect on the behavior of the walk, because in bottom-up mode the directories
|
|
|
|
in *dirnames* are generated before *dirpath* itself is generated.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-04-02 23:48:54 -03:00
|
|
|
By default, errors from the :func:`scandir` call are ignored. If optional
|
2007-08-15 11:28:22 -03:00
|
|
|
argument *onerror* is specified, it should be a function; it will be called with
|
|
|
|
one argument, an :exc:`OSError` instance. It can report the error to continue
|
|
|
|
with the walk, or raise the exception to abort the walk. Note that the filename
|
|
|
|
is available as the ``filename`` attribute of the exception object.
|
|
|
|
|
|
|
|
By default, :func:`walk` will not walk down into symbolic links that resolve to
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
directories. Set *followlinks* to ``True`` to visit directories pointed to by
|
2007-08-15 11:28:22 -03:00
|
|
|
symlinks, on systems that support them.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2012-06-24 06:45:20 -03:00
|
|
|
Be aware that setting *followlinks* to ``True`` can lead to infinite
|
|
|
|
recursion if a link points to a parent directory of itself. :func:`walk`
|
|
|
|
does not keep track of the directories it visited already.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
If you pass a relative pathname, don't change the current working directory
|
|
|
|
between resumptions of :func:`walk`. :func:`walk` never changes the current
|
|
|
|
directory, and assumes that its caller doesn't either.
|
|
|
|
|
|
|
|
This example displays the number of bytes taken by non-directory files in each
|
|
|
|
directory under the starting directory, except that it doesn't look under any
|
|
|
|
CVS subdirectory::
|
|
|
|
|
|
|
|
import os
|
|
|
|
from os.path import join, getsize
|
|
|
|
for root, dirs, files in os.walk('python/Lib/email'):
|
2007-09-04 04:15:32 -03:00
|
|
|
print(root, "consumes", end=" ")
|
|
|
|
print(sum(getsize(join(root, name)) for name in files), end=" ")
|
|
|
|
print("bytes in", len(files), "non-directory files")
|
2007-08-15 11:28:22 -03:00
|
|
|
if 'CVS' in dirs:
|
|
|
|
dirs.remove('CVS') # don't visit CVS directories
|
|
|
|
|
2015-03-10 09:31:47 -03:00
|
|
|
In the next example (simple implementation of :func:`shutil.rmtree`),
|
|
|
|
walking the tree bottom-up is essential, :func:`rmdir` doesn't allow
|
|
|
|
deleting a directory before the directory is empty::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
# Delete everything reachable from the directory named in "top",
|
2007-08-15 11:28:22 -03:00
|
|
|
# assuming there are no symbolic links.
|
|
|
|
# CAUTION: This is dangerous! For example, if top == '/', it
|
|
|
|
# could delete all your disk files.
|
|
|
|
import os
|
|
|
|
for root, dirs, files in os.walk(top, topdown=False):
|
|
|
|
for name in files:
|
|
|
|
os.remove(os.path.join(root, name))
|
|
|
|
for name in dirs:
|
|
|
|
os.rmdir(os.path.join(root, name))
|
|
|
|
|
2020-03-08 09:31:47 -03:00
|
|
|
.. audit-event:: os.walk top,topdown,onerror,followlinks os.walk
|
|
|
|
|
2015-03-10 09:20:34 -03:00
|
|
|
.. versionchanged:: 3.5
|
2015-05-15 04:12:58 -03:00
|
|
|
This function now calls :func:`os.scandir` instead of :func:`os.listdir`,
|
|
|
|
making it faster by reducing the number of calls to :func:`os.stat`.
|
2015-03-10 09:20:34 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-07-15 14:57:38 -03:00
|
|
|
.. function:: fwalk(top='.', topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=None)
|
2012-02-05 10:15:38 -04:00
|
|
|
|
|
|
|
.. index::
|
|
|
|
single: directory; walking
|
|
|
|
single: directory; traversal
|
|
|
|
|
2012-02-11 03:52:29 -04:00
|
|
|
This behaves exactly like :func:`walk`, except that it yields a 4-tuple
|
2012-06-25 08:49:05 -03:00
|
|
|
``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``.
|
2012-02-05 10:15:38 -04:00
|
|
|
|
|
|
|
*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output,
|
|
|
|
and *dirfd* is a file descriptor referring to the directory *dirpath*.
|
|
|
|
|
2012-06-25 08:49:05 -03:00
|
|
|
This function always supports :ref:`paths relative to directory descriptors
|
2012-07-15 14:57:38 -03:00
|
|
|
<dir_fd>` and :ref:`not following symlinks <follow_symlinks>`. Note however
|
2012-07-15 21:32:36 -03:00
|
|
|
that, unlike other functions, the :func:`fwalk` default value for
|
2012-07-15 14:57:38 -03:00
|
|
|
*follow_symlinks* is ``False``.
|
2012-06-25 08:49:05 -03:00
|
|
|
|
2012-02-05 10:15:38 -04:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Since :func:`fwalk` yields file descriptors, those are only valid until
|
|
|
|
the next iteration step, so you should duplicate them (e.g. with
|
|
|
|
:func:`dup`) if you want to keep them longer.
|
|
|
|
|
|
|
|
This example displays the number of bytes taken by non-directory files in each
|
|
|
|
directory under the starting directory, except that it doesn't look under any
|
|
|
|
CVS subdirectory::
|
|
|
|
|
|
|
|
import os
|
|
|
|
for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):
|
|
|
|
print(root, "consumes", end="")
|
2012-06-24 11:11:08 -03:00
|
|
|
print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),
|
2012-02-05 10:15:38 -04:00
|
|
|
end="")
|
|
|
|
print("bytes in", len(files), "non-directory files")
|
|
|
|
if 'CVS' in dirs:
|
|
|
|
dirs.remove('CVS') # don't visit CVS directories
|
|
|
|
|
|
|
|
In the next example, walking the tree bottom-up is essential:
|
2012-08-05 10:18:02 -03:00
|
|
|
:func:`rmdir` doesn't allow deleting a directory before the directory is
|
2012-02-05 10:15:38 -04:00
|
|
|
empty::
|
|
|
|
|
|
|
|
# Delete everything reachable from the directory named in "top",
|
|
|
|
# assuming there are no symbolic links.
|
|
|
|
# CAUTION: This is dangerous! For example, if top == '/', it
|
|
|
|
# could delete all your disk files.
|
|
|
|
import os
|
|
|
|
for root, dirs, files, rootfd in os.fwalk(top, topdown=False):
|
|
|
|
for name in files:
|
2012-08-05 10:18:02 -03:00
|
|
|
os.unlink(name, dir_fd=rootfd)
|
2012-02-05 10:15:38 -04:00
|
|
|
for name in dirs:
|
2012-08-05 10:18:02 -03:00
|
|
|
os.rmdir(name, dir_fd=rootfd)
|
2012-02-05 10:15:38 -04:00
|
|
|
|
2020-03-08 09:31:47 -03:00
|
|
|
.. audit-event:: os.fwalk top,topdown,onerror,follow_symlinks,dir_fd os.fwalk
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2012-02-05 10:15:38 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2017-03-07 08:33:21 -04:00
|
|
|
.. versionchanged:: 3.7
|
|
|
|
Added support for :class:`bytes` paths.
|
|
|
|
|
2012-02-05 10:15:38 -04:00
|
|
|
|
2019-05-29 16:57:07 -03:00
|
|
|
.. function:: memfd_create(name[, flags=os.MFD_CLOEXEC])
|
|
|
|
|
|
|
|
Create an anonymous file and return a file descriptor that refers to it.
|
|
|
|
*flags* must be one of the ``os.MFD_*`` constants available on the system
|
|
|
|
(or a bitwise ORed combination of them). By default, the new file
|
|
|
|
descriptor is :ref:`non-inheritable <fd_inheritance>`.
|
|
|
|
|
2019-06-05 07:24:52 -03:00
|
|
|
The name supplied in *name* is used as a filename and will be displayed as
|
|
|
|
the target of the corresponding symbolic link in the directory
|
|
|
|
``/proc/self/fd/``. The displayed name is always prefixed with ``memfd:``
|
|
|
|
and serves only for debugging purposes. Names do not affect the behavior of
|
|
|
|
the file descriptor, and as such multiple files can have the same name
|
|
|
|
without any side effects.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 3.17 with glibc >= 2.27.
|
2019-05-29 16:57:07 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.8
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: MFD_CLOEXEC
|
|
|
|
MFD_ALLOW_SEALING
|
|
|
|
MFD_HUGETLB
|
|
|
|
MFD_HUGE_SHIFT
|
|
|
|
MFD_HUGE_MASK
|
|
|
|
MFD_HUGE_64KB
|
|
|
|
MFD_HUGE_512KB
|
|
|
|
MFD_HUGE_1MB
|
|
|
|
MFD_HUGE_2MB
|
|
|
|
MFD_HUGE_8MB
|
|
|
|
MFD_HUGE_16MB
|
|
|
|
MFD_HUGE_32MB
|
|
|
|
MFD_HUGE_256MB
|
|
|
|
MFD_HUGE_512MB
|
|
|
|
MFD_HUGE_1GB
|
|
|
|
MFD_HUGE_2GB
|
|
|
|
MFD_HUGE_16GB
|
|
|
|
|
|
|
|
These flags can be passed to :func:`memfd_create`.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 3.17 with glibc >= 2.27
|
|
|
|
|
|
|
|
The ``MFD_HUGE*`` flags are only available since Linux 4.14.
|
2019-05-29 16:57:07 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.8
|
|
|
|
|
|
|
|
|
2020-11-13 14:48:52 -04:00
|
|
|
.. function:: eventfd(initval[, flags=os.EFD_CLOEXEC])
|
|
|
|
|
|
|
|
Create and return an event file descriptor. The file descriptors supports
|
|
|
|
raw :func:`read` and :func:`write` with a buffer size of 8,
|
|
|
|
:func:`~select.select`, :func:`~select.poll` and similar. See man page
|
|
|
|
:manpage:`eventfd(2)` for more information. By default, the
|
|
|
|
new file descriptor is :ref:`non-inheritable <fd_inheritance>`.
|
|
|
|
|
|
|
|
*initval* is the initial value of the event counter. The initial value
|
|
|
|
must be an 32 bit unsigned integer. Please note that the initial value is
|
|
|
|
limited to a 32 bit unsigned int although the event counter is an unsigned
|
|
|
|
64 bit integer with a maximum value of 2\ :sup:`64`\ -\ 2.
|
|
|
|
|
|
|
|
*flags* can be constructed from :const:`EFD_CLOEXEC`,
|
|
|
|
:const:`EFD_NONBLOCK`, and :const:`EFD_SEMAPHORE`.
|
|
|
|
|
|
|
|
If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero,
|
|
|
|
:func:`eventfd_read` returns 1 and decrements the counter by one.
|
|
|
|
|
|
|
|
If :const:`EFD_SEMAPHORE` is not specified and the event counter is
|
|
|
|
non-zero, :func:`eventfd_read` returns the current event counter value and
|
|
|
|
resets the counter to zero.
|
|
|
|
|
|
|
|
If the event counter is zero and :const:`EFD_NONBLOCK` is not
|
|
|
|
specified, :func:`eventfd_read` blocks.
|
|
|
|
|
|
|
|
:func:`eventfd_write` increments the event counter. Write blocks if the
|
|
|
|
write operation would increment the counter to a value larger than
|
|
|
|
2\ :sup:`64`\ -\ 2.
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
# semaphore with start value '1'
|
|
|
|
fd = os.eventfd(1, os.EFD_SEMAPHORE | os.EFC_CLOEXEC)
|
|
|
|
try:
|
|
|
|
# acquire semaphore
|
|
|
|
v = os.eventfd_read(fd)
|
|
|
|
try:
|
|
|
|
do_work()
|
|
|
|
finally:
|
|
|
|
# release semaphore
|
|
|
|
os.eventfd_write(fd, v)
|
|
|
|
finally:
|
|
|
|
os.close(fd)
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
2020-11-13 14:48:52 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
|
|
|
.. function:: eventfd_read(fd)
|
|
|
|
|
|
|
|
Read value from an :func:`eventfd` file descriptor and return a 64 bit
|
|
|
|
unsigned int. The function does not verify that *fd* is an :func:`eventfd`.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 2.6.27
|
2020-11-13 14:48:52 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
|
|
|
.. function:: eventfd_write(fd, value)
|
|
|
|
|
|
|
|
Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit
|
|
|
|
unsigned int. The function does not verify that *fd* is an :func:`eventfd`.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 2.6.27
|
2020-11-13 14:48:52 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
|
|
|
.. data:: EFD_CLOEXEC
|
|
|
|
|
|
|
|
Set close-on-exec flag for new :func:`eventfd` file descriptor.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 2.6.27
|
2020-11-13 14:48:52 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
|
|
|
.. data:: EFD_NONBLOCK
|
|
|
|
|
|
|
|
Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file
|
|
|
|
descriptor.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 2.6.27
|
2020-11-13 14:48:52 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
|
|
|
.. data:: EFD_SEMAPHORE
|
|
|
|
|
|
|
|
Provide semaphore-like semantics for reads from a :func:`eventfd` file
|
|
|
|
descriptor. On read the internal counter is decremented by one.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 2.6.30
|
2020-11-13 14:48:52 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
|
|
|
|
|
2023-10-07 14:33:22 -03:00
|
|
|
Timer File Descriptors
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
These functions provide support for Linux's *timer file descriptor* API.
|
|
|
|
Naturally, they are all only available on Linux.
|
|
|
|
|
|
|
|
.. function:: timerfd_create(clockid, /, *, flags=0)
|
|
|
|
|
|
|
|
Create and return a timer file descriptor (*timerfd*).
|
|
|
|
|
|
|
|
The file descriptor returned by :func:`timerfd_create` supports:
|
|
|
|
|
2023-10-11 17:43:03 -03:00
|
|
|
- :func:`read`
|
|
|
|
- :func:`~select.select`
|
|
|
|
- :func:`~select.poll`
|
2023-10-07 14:33:22 -03:00
|
|
|
|
|
|
|
The file descriptor's :func:`read` method can be called with a buffer size
|
|
|
|
of 8. If the timer has already expired one or more times, :func:`read`
|
|
|
|
returns the number of expirations with the host's endianness, which may be
|
|
|
|
converted to an :class:`int` by ``int.from_bytes(x, byteorder=sys.byteorder)``.
|
|
|
|
|
|
|
|
:func:`~select.select` and :func:`~select.poll` can be used to wait until
|
|
|
|
timer expires and the file descriptor is readable.
|
|
|
|
|
|
|
|
*clockid* must be a valid :ref:`clock ID <time-clock-id-constants>`,
|
|
|
|
as defined in the :py:mod:`time` module:
|
|
|
|
|
|
|
|
- :const:`time.CLOCK_REALTIME`
|
|
|
|
- :const:`time.CLOCK_MONOTONIC`
|
|
|
|
- :const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)
|
|
|
|
|
|
|
|
If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide
|
|
|
|
real-time clock is used. If system clock is changed, timer setting need
|
|
|
|
to be updated. To cancel timer when system clock is changed, see
|
|
|
|
:const:`TFD_TIMER_CANCEL_ON_SET`.
|
|
|
|
|
|
|
|
If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically
|
|
|
|
increasing clock is used. Even if the system clock is changed, the timer
|
|
|
|
setting will not be affected.
|
|
|
|
|
|
|
|
If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time.CLOCK_MONOTONIC`
|
|
|
|
except it includes any time that the system is suspended.
|
|
|
|
|
|
|
|
The file descriptor's behaviour can be modified by specifying a *flags* value.
|
|
|
|
Any of the following variables may used, combined using bitwise OR
|
|
|
|
(the ``|`` operator):
|
|
|
|
|
|
|
|
- :const:`TFD_NONBLOCK`
|
|
|
|
- :const:`TFD_CLOEXEC`
|
|
|
|
|
|
|
|
If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until
|
|
|
|
the timer expires. If it is set as a flag, :func:`read` doesn't block, but
|
|
|
|
If there hasn't been an expiration since the last call to read,
|
|
|
|
:func:`read` raises :class:`OSError` with ``errno`` is set to
|
|
|
|
:const:`errno.EAGAIN`.
|
|
|
|
|
|
|
|
:const:`TFD_CLOEXEC` is always set by Python automatically.
|
|
|
|
|
|
|
|
The file descriptor must be closed with :func:`os.close` when it is no
|
|
|
|
longer needed, or else the file descriptor will be leaked.
|
|
|
|
|
|
|
|
.. seealso:: The :manpage:`timerfd_create(2)` man page.
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: timerfd_settime(fd, /, *, flags=flags, initial=0.0, interval=0.0)
|
|
|
|
|
|
|
|
Alter a timer file descriptor's internal timer.
|
|
|
|
This function operates the same interval timer as :func:`timerfd_settime_ns`.
|
|
|
|
|
|
|
|
*fd* must be a valid timer file descriptor.
|
|
|
|
|
|
|
|
The timer's behaviour can be modified by specifying a *flags* value.
|
|
|
|
Any of the following variables may used, combined using bitwise OR
|
|
|
|
(the ``|`` operator):
|
|
|
|
|
|
|
|
- :const:`TFD_TIMER_ABSTIME`
|
|
|
|
- :const:`TFD_TIMER_CANCEL_ON_SET`
|
|
|
|
|
|
|
|
The timer is disabled by setting *initial* to zero (``0``).
|
|
|
|
If *initial* is equal to or greater than zero, the timer is enabled.
|
|
|
|
If *initial* is less than zero, it raises an :class:`OSError` exception
|
|
|
|
with ``errno`` set to :const:`errno.EINVAL`
|
|
|
|
|
|
|
|
By default the timer will fire when *initial* seconds have elapsed.
|
|
|
|
(If *initial* is zero, timer will fire immediately.)
|
|
|
|
|
|
|
|
However, if the :const:`TFD_TIMER_ABSTIME` flag is set,
|
|
|
|
the timer will fire when the timer's clock
|
|
|
|
(set by *clockid* in :func:`timerfd_create`) reaches *initial* seconds.
|
|
|
|
|
|
|
|
The timer's interval is set by the *interval* :py:class:`float`.
|
|
|
|
If *interval* is zero, the timer only fires once, on the initial expiration.
|
|
|
|
If *interval* is greater than zero, the timer fires every time *interval*
|
|
|
|
seconds have elapsed since the previous expiration.
|
|
|
|
If *interval* is less than zero, it raises :class:`OSError` with ``errno``
|
|
|
|
set to :const:`errno.EINVAL`
|
|
|
|
|
|
|
|
If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with
|
|
|
|
:const:`TFD_TIMER_ABSTIME` and the clock for this timer is
|
|
|
|
:const:`time.CLOCK_REALTIME`, the timer is marked as cancelable if the
|
|
|
|
real-time clock is changed discontinuously. Reading the descriptor is
|
|
|
|
aborted with the error ECANCELED.
|
|
|
|
|
|
|
|
Linux manages system clock as UTC. A daylight-savings time transition is
|
|
|
|
done by changing time offset only and doesn't cause discontinuous system
|
|
|
|
clock change.
|
|
|
|
|
|
|
|
Discontinuous system clock change will be caused by the following events:
|
|
|
|
|
2023-10-11 17:43:03 -03:00
|
|
|
- ``settimeofday``
|
|
|
|
- ``clock_settime``
|
|
|
|
- set the system date and time by ``date`` command
|
2023-10-07 14:33:22 -03:00
|
|
|
|
|
|
|
Return a two-item tuple of (``next_expiration``, ``interval``) from
|
|
|
|
the previous timer state, before this function executed.
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
:manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`,
|
|
|
|
:manpage:`settimeofday(2)`, :manpage:`clock_settime(2)`,
|
|
|
|
and :manpage:`date(1)`.
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: timerfd_settime_ns(fd, /, *, flags=0, initial=0, interval=0)
|
|
|
|
|
|
|
|
Similar to :func:`timerfd_settime`, but use time as nanoseconds.
|
|
|
|
This function operates the same interval timer as :func:`timerfd_settime`.
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: timerfd_gettime(fd, /)
|
|
|
|
|
|
|
|
Return a two-item tuple of floats (``next_expiration``, ``interval``).
|
|
|
|
|
|
|
|
``next_expiration`` denotes the relative time until next the timer next fires,
|
|
|
|
regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set.
|
|
|
|
|
|
|
|
``interval`` denotes the timer's interval.
|
|
|
|
If zero, the timer will only fire once, after ``next_expiration`` seconds
|
|
|
|
have elapsed.
|
|
|
|
|
|
|
|
.. seealso:: :manpage:`timerfd_gettime(2)`
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: timerfd_gettime_ns(fd, /)
|
|
|
|
|
|
|
|
Similar to :func:`timerfd_gettime`, but return time as nanoseconds.
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
.. data:: TFD_NONBLOCK
|
|
|
|
|
|
|
|
A flag for the :func:`timerfd_create` function,
|
|
|
|
which sets the :const:`O_NONBLOCK` status flag for the new timer file
|
|
|
|
descriptor. If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks.
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
.. data:: TFD_CLOEXEC
|
|
|
|
|
|
|
|
A flag for the :func:`timerfd_create` function,
|
|
|
|
If :const:`TFD_CLOEXEC` is set as a flag, set close-on-exec flag for new file
|
|
|
|
descriptor.
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
.. data:: TFD_TIMER_ABSTIME
|
|
|
|
|
|
|
|
A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` functions.
|
|
|
|
If this flag is set, *initial* is interpreted as an absolute value on the
|
|
|
|
timer's clock (in UTC seconds or nanoseconds since the Unix Epoch).
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
.. data:: TFD_TIMER_CANCEL_ON_SET
|
|
|
|
|
|
|
|
A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns`
|
|
|
|
functions along with :const:`TFD_TIMER_ABSTIME`.
|
|
|
|
The timer is cancelled when the time of the underlying clock changes
|
|
|
|
discontinuously.
|
|
|
|
|
|
|
|
.. availability:: Linux >= 2.6.27 with glibc >= 2.8
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
|
2012-06-24 06:57:07 -03:00
|
|
|
Linux extended attributes
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
These functions are all available on Linux only.
|
|
|
|
|
|
|
|
.. function:: getxattr(path, attribute, *, follow_symlinks=True)
|
|
|
|
|
|
|
|
Return the value of the extended filesystem attribute *attribute* for
|
2016-09-06 19:55:02 -03:00
|
|
|
*path*. *attribute* can be bytes or str (directly or indirectly through the
|
|
|
|
:class:`PathLike` interface). If it is str, it is encoded with the filesystem
|
|
|
|
encoding.
|
2012-06-24 06:57:07 -03:00
|
|
|
|
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>` and
|
|
|
|
:ref:`not following symlinks <follow_symlinks>`.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.getxattr path,attribute os.getxattr
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
2017-02-18 20:17:35 -04:00
|
|
|
Accepts a :term:`path-like object` for *path* and *attribute*.
|
2016-09-06 19:55:02 -03:00
|
|
|
|
2012-06-24 06:57:07 -03:00
|
|
|
|
|
|
|
.. function:: listxattr(path=None, *, follow_symlinks=True)
|
|
|
|
|
|
|
|
Return a list of the extended filesystem attributes on *path*. The
|
|
|
|
attributes in the list are represented as strings decoded with the filesystem
|
|
|
|
encoding. If *path* is ``None``, :func:`listxattr` will examine the current
|
|
|
|
directory.
|
|
|
|
|
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>` and
|
|
|
|
:ref:`not following symlinks <follow_symlinks>`.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.listxattr path os.listxattr
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2012-06-24 06:57:07 -03:00
|
|
|
|
|
|
|
.. function:: removexattr(path, attribute, *, follow_symlinks=True)
|
|
|
|
|
|
|
|
Removes the extended filesystem attribute *attribute* from *path*.
|
2016-09-06 19:55:02 -03:00
|
|
|
*attribute* should be bytes or str (directly or indirectly through the
|
|
|
|
:class:`PathLike` interface). If it is a string, it is encoded
|
2020-11-02 11:49:54 -04:00
|
|
|
with the :term:`filesystem encoding and error handler`.
|
2012-06-24 06:57:07 -03:00
|
|
|
|
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>` and
|
|
|
|
:ref:`not following symlinks <follow_symlinks>`.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.removexattr path,attribute os.removexattr
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object` for *path* and *attribute*.
|
|
|
|
|
2012-06-24 06:57:07 -03:00
|
|
|
|
|
|
|
.. function:: setxattr(path, attribute, value, flags=0, *, follow_symlinks=True)
|
|
|
|
|
|
|
|
Set the extended filesystem attribute *attribute* on *path* to *value*.
|
2016-09-06 19:55:02 -03:00
|
|
|
*attribute* must be a bytes or str with no embedded NULs (directly or
|
|
|
|
indirectly through the :class:`PathLike` interface). If it is a str,
|
2020-11-02 11:49:54 -04:00
|
|
|
it is encoded with the :term:`filesystem encoding and error handler`. *flags* may be
|
2012-06-24 06:57:07 -03:00
|
|
|
:data:`XATTR_REPLACE` or :data:`XATTR_CREATE`. If :data:`XATTR_REPLACE` is
|
2021-05-01 17:54:39 -03:00
|
|
|
given and the attribute does not exist, ``ENODATA`` will be raised.
|
2012-06-24 06:57:07 -03:00
|
|
|
If :data:`XATTR_CREATE` is given and the attribute already exists, the
|
2021-05-01 17:54:39 -03:00
|
|
|
attribute will not be created and ``EEXISTS`` will be raised.
|
2012-06-24 06:57:07 -03:00
|
|
|
|
|
|
|
This function can support :ref:`specifying a file descriptor <path_fd>` and
|
|
|
|
:ref:`not following symlinks <follow_symlinks>`.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
A bug in Linux kernel versions less than 2.6.39 caused the flags argument
|
|
|
|
to be ignored on some filesystems.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.setxattr path,attribute,value,flags os.setxattr
|
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object` for *path* and *attribute*.
|
|
|
|
|
2012-06-24 06:57:07 -03:00
|
|
|
|
|
|
|
.. data:: XATTR_SIZE_MAX
|
|
|
|
|
|
|
|
The maximum size the value of an extended attribute can be. Currently, this
|
2013-02-16 11:29:56 -04:00
|
|
|
is 64 KiB on Linux.
|
2012-06-24 06:57:07 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: XATTR_CREATE
|
|
|
|
|
|
|
|
This is a possible value for the flags argument in :func:`setxattr`. It
|
|
|
|
indicates the operation must create an attribute.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: XATTR_REPLACE
|
|
|
|
|
|
|
|
This is a possible value for the flags argument in :func:`setxattr`. It
|
|
|
|
indicates the operation must replace an existing attribute.
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. _os-process:
|
|
|
|
|
|
|
|
Process Management
|
|
|
|
------------------
|
|
|
|
|
|
|
|
These functions may be used to create and manage processes.
|
|
|
|
|
2013-10-13 14:12:43 -03:00
|
|
|
The various :func:`exec\* <execl>` functions take a list of arguments for the new
|
2007-08-15 11:28:22 -03:00
|
|
|
program loaded into the process. In each case, the first of these arguments is
|
|
|
|
passed to the new program as its own name rather than as an argument a user may
|
|
|
|
have typed on a command line. For the C programmer, this is the ``argv[0]``
|
2010-10-06 07:11:56 -03:00
|
|
|
passed to a program's :c:func:`main`. For example, ``os.execv('/bin/echo',
|
2007-08-15 11:28:22 -03:00
|
|
|
['foo', 'bar'])`` will only print ``bar`` on standard output; ``foo`` will seem
|
|
|
|
to be ignored.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: abort()
|
|
|
|
|
|
|
|
Generate a :const:`SIGABRT` signal to the current process. On Unix, the default
|
|
|
|
behavior is to produce a core dump; on Windows, the process immediately returns
|
2011-07-07 21:26:39 -03:00
|
|
|
an exit code of ``3``. Be aware that calling this function will not call the
|
|
|
|
Python signal handler registered for :const:`SIGABRT` with
|
|
|
|
:func:`signal.signal`.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-03-29 20:37:16 -03:00
|
|
|
.. function:: add_dll_directory(path)
|
|
|
|
|
|
|
|
Add a path to the DLL search path.
|
|
|
|
|
|
|
|
This search path is used when resolving dependencies for imported
|
2022-04-20 00:59:48 -03:00
|
|
|
extension modules (the module itself is resolved through
|
|
|
|
:data:`sys.path`), and also by :mod:`ctypes`.
|
2019-03-29 20:37:16 -03:00
|
|
|
|
|
|
|
Remove the directory by calling **close()** on the returned object
|
|
|
|
or using it in a :keyword:`with` statement.
|
|
|
|
|
|
|
|
See the `Microsoft documentation
|
|
|
|
<https://msdn.microsoft.com/44228cf2-6306-466c-8f16-f513cd3ba8b5>`_
|
|
|
|
for more information about how DLLs are loaded.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.add_dll_directory path os.add_dll_directory
|
|
|
|
|
2019-03-29 20:37:16 -03:00
|
|
|
.. availability:: Windows.
|
|
|
|
|
|
|
|
.. versionadded:: 3.8
|
|
|
|
Previous versions of CPython would resolve DLLs using the default
|
|
|
|
behavior for the current process. This led to inconsistencies,
|
|
|
|
such as only sometimes searching :envvar:`PATH` or the current
|
|
|
|
working directory, and OS functions such as ``AddDllDirectory``
|
|
|
|
having no effect.
|
|
|
|
|
|
|
|
In 3.8, the two primary ways DLLs are loaded now explicitly
|
|
|
|
override the process-wide behavior to ensure consistency. See the
|
|
|
|
:ref:`porting notes <bpo-36085-whatsnew>` for information on
|
|
|
|
updating libraries.
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: execl(path, arg0, arg1, ...)
|
|
|
|
execle(path, arg0, arg1, ..., env)
|
|
|
|
execlp(file, arg0, arg1, ...)
|
|
|
|
execlpe(file, arg0, arg1, ..., env)
|
|
|
|
execv(path, args)
|
|
|
|
execve(path, args, env)
|
|
|
|
execvp(file, args)
|
|
|
|
execvpe(file, args, env)
|
|
|
|
|
|
|
|
These functions all execute a new program, replacing the current process; they
|
|
|
|
do not return. On Unix, the new executable is loaded into the current process,
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
and will have the same process id as the caller. Errors will be reported as
|
2009-01-03 17:18:54 -04:00
|
|
|
:exc:`OSError` exceptions.
|
Devil merge!
Merged revisions 66561,66564,66580,66610,66614,66618,66624-66625,66628-66629,66643,66645,66660-66665 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66561 | benjamin.peterson | 2008-09-22 17:13:29 -0500 (Mon, 22 Sep 2008) | 1 line
clean up docs for platform's linux_distribution and dist functions
........
r66564 | benjamin.peterson | 2008-09-23 08:32:46 -0500 (Tue, 23 Sep 2008) | 1 line
mention how to override boolean evaluation
........
r66580 | georg.brandl | 2008-09-24 04:47:55 -0500 (Wed, 24 Sep 2008) | 2 lines
Indentation normalization.
........
r66610 | andrew.kuchling | 2008-09-24 12:27:55 -0500 (Wed, 24 Sep 2008) | 1 line
Improve wording
........
r66614 | benjamin.peterson | 2008-09-24 17:11:59 -0500 (Wed, 24 Sep 2008) | 4 lines
#3950 fix missing scale factors in turtle.py
reviewers: Georg, Benjamin
........
r66618 | benjamin.peterson | 2008-09-25 15:35:45 -0500 (Thu, 25 Sep 2008) | 1 line
add a NEWs entry for r66614
........
r66624 | raymond.hettinger | 2008-09-25 18:31:52 -0500 (Thu, 25 Sep 2008) | 1 line
Fix namedtuple bug reported by Glenn Linderman. Template did not form correctly if the field names were input in Unicode.
........
r66625 | benjamin.peterson | 2008-09-25 21:58:36 -0500 (Thu, 25 Sep 2008) | 1 line
add the beginnings of a C-API 2 -> 3 porting guide
........
r66628 | benjamin.peterson | 2008-09-26 15:52:06 -0500 (Fri, 26 Sep 2008) | 1 line
add an 'other options' section
........
r66629 | georg.brandl | 2008-09-26 16:15:21 -0500 (Fri, 26 Sep 2008) | 2 lines
typos.
........
r66643 | andrew.kuchling | 2008-09-27 09:12:33 -0500 (Sat, 27 Sep 2008) | 1 line
Add a last bunch of items
........
r66645 | benjamin.peterson | 2008-09-27 11:23:55 -0500 (Sat, 27 Sep 2008) | 1 line
2to3's api should be considered unstable
........
r66660 | andrew.kuchling | 2008-09-27 17:54:08 -0500 (Sat, 27 Sep 2008) | 1 line
#3510: future-proof text
........
r66661 | benjamin.peterson | 2008-09-27 18:28:43 -0500 (Sat, 27 Sep 2008) | 1 line
clarify a few things
........
r66662 | andrew.kuchling | 2008-09-27 19:15:27 -0500 (Sat, 27 Sep 2008) | 1 line
#1579477: mention necessity to flush output before exec'ing
........
r66663 | andrew.kuchling | 2008-09-27 20:08:47 -0500 (Sat, 27 Sep 2008) | 1 line
#1415508: Document two functions
........
r66664 | benjamin.peterson | 2008-09-27 20:51:36 -0500 (Sat, 27 Sep 2008) | 1 line
better grammar
........
r66665 | benjamin.peterson | 2008-09-27 20:53:29 -0500 (Sat, 27 Sep 2008) | 1 line
note the 2to3 -d could be useful for other refactoring
........
2008-09-27 23:06:32 -03:00
|
|
|
|
|
|
|
The current process is replaced immediately. Open file objects and
|
|
|
|
descriptors are not flushed, so if there may be data buffered
|
|
|
|
on these open files, you should flush them using
|
|
|
|
:func:`sys.stdout.flush` or :func:`os.fsync` before calling an
|
2013-10-13 14:12:43 -03:00
|
|
|
:func:`exec\* <execl>` function.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-10-13 14:12:43 -03:00
|
|
|
The "l" and "v" variants of the :func:`exec\* <execl>` functions differ in how
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
command-line arguments are passed. The "l" variants are perhaps the easiest
|
2007-08-15 11:28:22 -03:00
|
|
|
to work with if the number of parameters is fixed when the code is written; the
|
|
|
|
individual parameters simply become additional parameters to the :func:`execl\*`
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
functions. The "v" variants are good when the number of parameters is
|
2007-08-15 11:28:22 -03:00
|
|
|
variable, with the arguments being passed in a list or tuple as the *args*
|
|
|
|
parameter. In either case, the arguments to the child process should start with
|
|
|
|
the name of the command being run, but this is not enforced.
|
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
The variants which include a "p" near the end (:func:`execlp`,
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the
|
|
|
|
:envvar:`PATH` environment variable to locate the program *file*. When the
|
2013-10-13 14:12:43 -03:00
|
|
|
environment is being replaced (using one of the :func:`exec\*e <execl>` variants,
|
2007-08-15 11:28:22 -03:00
|
|
|
discussed in the next paragraph), the new environment is used as the source of
|
|
|
|
the :envvar:`PATH` variable. The other variants, :func:`execl`, :func:`execle`,
|
|
|
|
:func:`execv`, and :func:`execve`, will not use the :envvar:`PATH` variable to
|
|
|
|
locate the executable; *path* must contain an appropriate absolute or relative
|
2023-04-24 10:52:31 -03:00
|
|
|
path. Relative paths must include at least one slash, even on Windows, as
|
|
|
|
plain names will not be resolved.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` (note
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
that these all end in "e"), the *env* parameter must be a mapping which is
|
Merged revisions 62386-62387,62389-62393,62396,62400-62402,62407,62409-62410,62412-62414,62418-62419 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62386 | christian.heimes | 2008-04-19 04:23:57 +0200 (Sat, 19 Apr 2008) | 2 lines
Added kill, terminate and send_signal to subprocess.Popen
The bits and pieces for the Windows side were already in place. The POSIX side is trivial (as usual) and uses os.kill().
........
r62387 | georg.brandl | 2008-04-19 10:23:59 +0200 (Sat, 19 Apr 2008) | 2 lines
Fix-up docs for revision 62386.
........
r62389 | georg.brandl | 2008-04-19 18:57:43 +0200 (Sat, 19 Apr 2008) | 2 lines
#2369: clarify that copyfile() doesn't take a target directory.
........
r62390 | georg.brandl | 2008-04-19 18:58:28 +0200 (Sat, 19 Apr 2008) | 2 lines
#2634: clarify meaning of env parameter to spawn/exec*e.
........
r62391 | georg.brandl | 2008-04-19 18:58:49 +0200 (Sat, 19 Apr 2008) | 2 lines
#2633: clarify meaning of env parameter.
........
r62392 | georg.brandl | 2008-04-19 18:59:16 +0200 (Sat, 19 Apr 2008) | 2 lines
#2631: clarify IMPORT_NAME semantics.
........
r62393 | georg.brandl | 2008-04-19 19:00:14 +0200 (Sat, 19 Apr 2008) | 2 lines
:func: et al. should *not* include the parens.
........
r62396 | mark.dickinson | 2008-04-19 20:51:48 +0200 (Sat, 19 Apr 2008) | 5 lines
Additional tests for math.pow, and extra special-case
handling code in math.pow, in the hope of making all
tests pass on the alpha Tru64 buildbot.
........
r62400 | mark.dickinson | 2008-04-19 21:41:52 +0200 (Sat, 19 Apr 2008) | 3 lines
Additional special-case handling for math.pow.
Windows/VS2008 doesn't like (-1)**(+-inf).
........
r62401 | benjamin.peterson | 2008-04-19 21:47:34 +0200 (Sat, 19 Apr 2008) | 2 lines
Complete documentation for errors argument of io's open and TextIOWrapper
........
r62402 | mark.dickinson | 2008-04-19 22:31:16 +0200 (Sat, 19 Apr 2008) | 2 lines
Document updates to math and cmath modules.
........
r62407 | georg.brandl | 2008-04-19 23:28:38 +0200 (Sat, 19 Apr 2008) | 2 lines
Update template for newest Sphinx.
........
r62409 | mark.dickinson | 2008-04-19 23:35:35 +0200 (Sat, 19 Apr 2008) | 5 lines
Correct documentation for math.pow;
0**nan is nan, not 0. (But nan**0 and 1**nan are 1.)
Also fix minor typo: 'quite NaN' -> 'quiet NaN'
........
r62410 | mark.dickinson | 2008-04-19 23:49:22 +0200 (Sat, 19 Apr 2008) | 4 lines
Move asinh documentation to the proper place.
Remove meaningless 'in radians' from inverse
hyperbolic functions.
........
r62412 | mark.dickinson | 2008-04-20 03:22:30 +0200 (Sun, 20 Apr 2008) | 5 lines
Report additional diagnostic information in
test_math, to help track down debian-alpha
buildbot failure.
........
r62413 | mark.dickinson | 2008-04-20 03:39:24 +0200 (Sun, 20 Apr 2008) | 3 lines
FreeBSD doesn't follow C99 for modf(inf); so add explicit
special-value handling to math.modf code.
........
r62414 | mark.dickinson | 2008-04-20 06:13:13 +0200 (Sun, 20 Apr 2008) | 5 lines
Yet more explicit special case handling to make
math.pow behave on alpha Tru64. All IEEE 754
special values are now handled directly; only
the finite**finite case is handled by libm.
........
r62418 | mark.dickinson | 2008-04-20 18:13:17 +0200 (Sun, 20 Apr 2008) | 7 lines
Issue 2662: Initialize special value tables dynamically (i.e. when
cmath module is loaded) instead of statically. This fixes compile-time
problems on platforms where HUGE_VAL is an extern variable rather than
a constant.
Thanks Hirokazu Yamamoto for the patch.
........
r62419 | andrew.kuchling | 2008-04-20 18:54:02 +0200 (Sun, 20 Apr 2008) | 1 line
Move description of math module changes; various edits to description of cmath changes
........
2008-04-20 18:01:16 -03:00
|
|
|
used to define the environment variables for the new process (these are used
|
|
|
|
instead of the current process' environment); the functions :func:`execl`,
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`execlp`, :func:`execv`, and :func:`execvp` all cause the new process to
|
2009-01-03 17:18:54 -04:00
|
|
|
inherit the environment of the current process.
|
Devil merge!
Merged revisions 66561,66564,66580,66610,66614,66618,66624-66625,66628-66629,66643,66645,66660-66665 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66561 | benjamin.peterson | 2008-09-22 17:13:29 -0500 (Mon, 22 Sep 2008) | 1 line
clean up docs for platform's linux_distribution and dist functions
........
r66564 | benjamin.peterson | 2008-09-23 08:32:46 -0500 (Tue, 23 Sep 2008) | 1 line
mention how to override boolean evaluation
........
r66580 | georg.brandl | 2008-09-24 04:47:55 -0500 (Wed, 24 Sep 2008) | 2 lines
Indentation normalization.
........
r66610 | andrew.kuchling | 2008-09-24 12:27:55 -0500 (Wed, 24 Sep 2008) | 1 line
Improve wording
........
r66614 | benjamin.peterson | 2008-09-24 17:11:59 -0500 (Wed, 24 Sep 2008) | 4 lines
#3950 fix missing scale factors in turtle.py
reviewers: Georg, Benjamin
........
r66618 | benjamin.peterson | 2008-09-25 15:35:45 -0500 (Thu, 25 Sep 2008) | 1 line
add a NEWs entry for r66614
........
r66624 | raymond.hettinger | 2008-09-25 18:31:52 -0500 (Thu, 25 Sep 2008) | 1 line
Fix namedtuple bug reported by Glenn Linderman. Template did not form correctly if the field names were input in Unicode.
........
r66625 | benjamin.peterson | 2008-09-25 21:58:36 -0500 (Thu, 25 Sep 2008) | 1 line
add the beginnings of a C-API 2 -> 3 porting guide
........
r66628 | benjamin.peterson | 2008-09-26 15:52:06 -0500 (Fri, 26 Sep 2008) | 1 line
add an 'other options' section
........
r66629 | georg.brandl | 2008-09-26 16:15:21 -0500 (Fri, 26 Sep 2008) | 2 lines
typos.
........
r66643 | andrew.kuchling | 2008-09-27 09:12:33 -0500 (Sat, 27 Sep 2008) | 1 line
Add a last bunch of items
........
r66645 | benjamin.peterson | 2008-09-27 11:23:55 -0500 (Sat, 27 Sep 2008) | 1 line
2to3's api should be considered unstable
........
r66660 | andrew.kuchling | 2008-09-27 17:54:08 -0500 (Sat, 27 Sep 2008) | 1 line
#3510: future-proof text
........
r66661 | benjamin.peterson | 2008-09-27 18:28:43 -0500 (Sat, 27 Sep 2008) | 1 line
clarify a few things
........
r66662 | andrew.kuchling | 2008-09-27 19:15:27 -0500 (Sat, 27 Sep 2008) | 1 line
#1579477: mention necessity to flush output before exec'ing
........
r66663 | andrew.kuchling | 2008-09-27 20:08:47 -0500 (Sat, 27 Sep 2008) | 1 line
#1415508: Document two functions
........
r66664 | benjamin.peterson | 2008-09-27 20:51:36 -0500 (Sat, 27 Sep 2008) | 1 line
better grammar
........
r66665 | benjamin.peterson | 2008-09-27 20:53:29 -0500 (Sat, 27 Sep 2008) | 1 line
note the 2to3 -d could be useful for other refactoring
........
2008-09-27 23:06:32 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
For :func:`execve` on some platforms, *path* may also be specified as an open
|
|
|
|
file descriptor. This functionality may not be supported on your platform;
|
|
|
|
you can check whether or not it is available using :data:`os.supports_fd`.
|
|
|
|
If it is unavailable, using it will raise a :exc:`NotImplementedError`.
|
|
|
|
|
2020-02-04 20:15:00 -04:00
|
|
|
.. audit-event:: os.exec path,args,env os.execl
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, Windows, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-22 20:30:09 -03:00
|
|
|
.. versionadded:: 3.3
|
2019-05-06 09:39:13 -03:00
|
|
|
Added support for specifying *path* as an open file descriptor
|
2012-06-22 20:30:09 -03:00
|
|
|
for :func:`execve`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: _exit(n)
|
|
|
|
|
2010-10-17 07:51:45 -03:00
|
|
|
Exit the process with status *n*, without calling cleanup handlers, flushing
|
2010-05-06 20:03:05 -03:00
|
|
|
stdio buffers, etc.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. note::
|
|
|
|
|
2023-03-21 18:58:31 -03:00
|
|
|
The standard way to exit is :func:`sys.exit(n) <sys.exit>`. :func:`!_exit` should
|
2010-10-17 07:51:45 -03:00
|
|
|
normally only be used in the child process after a :func:`fork`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
The following exit codes are defined and can be used with :func:`_exit`,
|
2007-08-15 11:28:22 -03:00
|
|
|
although they are not required. These are typically used for system programs
|
|
|
|
written in Python, such as a mail server's external command delivery program.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Some of these may not be available on all Unix platforms, since there is some
|
|
|
|
variation. These constants are defined where they are defined by the underlying
|
|
|
|
platform.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_OK
|
|
|
|
|
2021-06-24 13:45:18 -03:00
|
|
|
Exit code that means no error occurred. May be taken from the defined value of
|
|
|
|
``EXIT_SUCCESS`` on some platforms. Generally has a value of zero.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2021-06-24 13:45:18 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_USAGE
|
|
|
|
|
|
|
|
Exit code that means the command was used incorrectly, such as when the wrong
|
2010-05-06 20:03:05 -03:00
|
|
|
number of arguments are given.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_DATAERR
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Exit code that means the input data was incorrect.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_NOINPUT
|
|
|
|
|
|
|
|
Exit code that means an input file did not exist or was not readable.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_NOUSER
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Exit code that means a specified user did not exist.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_NOHOST
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Exit code that means a specified host did not exist.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_UNAVAILABLE
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Exit code that means that a required service is unavailable.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_SOFTWARE
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Exit code that means an internal software error was detected.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_OSERR
|
|
|
|
|
|
|
|
Exit code that means an operating system error was detected, such as the
|
2010-05-06 20:03:05 -03:00
|
|
|
inability to fork or create a pipe.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_OSFILE
|
|
|
|
|
|
|
|
Exit code that means some system file did not exist, could not be opened, or had
|
2010-05-06 20:03:05 -03:00
|
|
|
some other kind of error.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_CANTCREAT
|
|
|
|
|
|
|
|
Exit code that means a user specified output file could not be created.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_IOERR
|
|
|
|
|
|
|
|
Exit code that means that an error occurred while doing I/O on some file.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_TEMPFAIL
|
|
|
|
|
|
|
|
Exit code that means a temporary failure occurred. This indicates something
|
|
|
|
that may not really be an error, such as a network connection that couldn't be
|
2010-05-06 20:03:05 -03:00
|
|
|
made during a retryable operation.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_PROTOCOL
|
|
|
|
|
|
|
|
Exit code that means that a protocol exchange was illegal, invalid, or not
|
2010-05-06 20:03:05 -03:00
|
|
|
understood.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_NOPERM
|
|
|
|
|
|
|
|
Exit code that means that there were insufficient permissions to perform the
|
2010-05-06 20:03:05 -03:00
|
|
|
operation (but not intended for file system problems).
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_CONFIG
|
|
|
|
|
|
|
|
Exit code that means that some kind of configuration error occurred.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: EX_NOTFOUND
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Exit code that means something like "an entry was not found".
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: fork()
|
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
Fork a child process. Return ``0`` in the child and the child's process id in the
|
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61239 | andrew.kuchling | 2008-03-05 01:44:41 +0100 (Wed, 05 Mar 2008) | 1 line
Add more items; add fragmentary notes
........
r61240 | amaury.forgeotdarc | 2008-03-05 02:50:33 +0100 (Wed, 05 Mar 2008) | 13 lines
Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::
>>> f(**g(1=2))
XXX undetected error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
instead of the expected SyntaxError: keyword can't be an expression
Will backport.
........
r61241 | neal.norwitz | 2008-03-05 06:10:48 +0100 (Wed, 05 Mar 2008) | 3 lines
Remove the files/dirs after closing the DB so the tests work on Windows.
Patch from Trent Nelson. Also simplified removing a file by using test_support.
........
r61242 | neal.norwitz | 2008-03-05 06:14:18 +0100 (Wed, 05 Mar 2008) | 3 lines
Get this test to pass even when there is no sound card in the system.
Patch from Trent Nelson. (I can't test this.)
........
r61243 | neal.norwitz | 2008-03-05 06:20:44 +0100 (Wed, 05 Mar 2008) | 3 lines
Catch OSError when trying to remove a file in case removal fails. This
should prevent a failure in tearDown masking any real test failure.
........
r61244 | neal.norwitz | 2008-03-05 06:38:06 +0100 (Wed, 05 Mar 2008) | 5 lines
Make the timeout longer to give slow machines a chance to pass the test
before timing out. This doesn't change the duration of the test under
normal circumstances. This is targetted at fixing the spurious failures
on the FreeBSD buildbot primarily.
........
r61245 | neal.norwitz | 2008-03-05 06:49:03 +0100 (Wed, 05 Mar 2008) | 1 line
Tabs -> spaces
........
r61246 | neal.norwitz | 2008-03-05 06:50:20 +0100 (Wed, 05 Mar 2008) | 1 line
Use -u urlfetch to run more tests
........
r61247 | neal.norwitz | 2008-03-05 06:51:20 +0100 (Wed, 05 Mar 2008) | 1 line
test_smtplib sometimes reports leaks too, suppress it
........
r61248 | jeffrey.yasskin | 2008-03-05 07:19:56 +0100 (Wed, 05 Mar 2008) | 5 lines
Fix test_socketserver on Windows after r61099 added several signal.alarm()
calls (which don't exist on non-Unix platforms).
Thanks to Trent Nelson for the report and patch.
........
r61249 | georg.brandl | 2008-03-05 08:10:35 +0100 (Wed, 05 Mar 2008) | 2 lines
Fix some rst.
........
r61252 | thomas.heller | 2008-03-05 15:53:39 +0100 (Wed, 05 Mar 2008) | 2 lines
News entry for yesterdays commit.
........
r61253 | thomas.heller | 2008-03-05 16:34:29 +0100 (Wed, 05 Mar 2008) | 3 lines
Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
........
r61254 | skip.montanaro | 2008-03-05 17:41:09 +0100 (Wed, 05 Mar 2008) | 4 lines
Elaborate on the role of the altinstall target when installing multiple
versions.
........
r61255 | georg.brandl | 2008-03-05 20:31:44 +0100 (Wed, 05 Mar 2008) | 2 lines
#2239: PYTHONPATH delimiter is os.pathsep.
........
r61256 | raymond.hettinger | 2008-03-05 21:59:58 +0100 (Wed, 05 Mar 2008) | 1 line
C implementation of itertools.permutations().
........
r61257 | raymond.hettinger | 2008-03-05 22:04:32 +0100 (Wed, 05 Mar 2008) | 1 line
Small code cleanup.
........
r61260 | martin.v.loewis | 2008-03-05 23:24:31 +0100 (Wed, 05 Mar 2008) | 2 lines
cd PCbuild only after deleting all pyc files.
........
r61261 | raymond.hettinger | 2008-03-06 02:15:52 +0100 (Thu, 06 Mar 2008) | 1 line
Add examples.
........
r61262 | andrew.kuchling | 2008-03-06 02:36:27 +0100 (Thu, 06 Mar 2008) | 1 line
Add two items
........
r61263 | georg.brandl | 2008-03-06 07:47:18 +0100 (Thu, 06 Mar 2008) | 2 lines
#1725737: ignore other VC directories other than CVS and SVN's too.
........
r61264 | martin.v.loewis | 2008-03-06 07:55:22 +0100 (Thu, 06 Mar 2008) | 4 lines
Patch #2232: os.tmpfile might fail on Windows if the user has no
permission to create files in the root directory.
Will backport to 2.5.
........
r61269 | georg.brandl | 2008-03-06 08:19:15 +0100 (Thu, 06 Mar 2008) | 2 lines
Expand on re.split behavior with captured expressions.
........
r61270 | georg.brandl | 2008-03-06 08:22:09 +0100 (Thu, 06 Mar 2008) | 2 lines
Little clarification of assignments.
........
r61271 | georg.brandl | 2008-03-06 08:31:34 +0100 (Thu, 06 Mar 2008) | 2 lines
Add isinstance/issubclass to tutorial.
........
r61272 | georg.brandl | 2008-03-06 08:34:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Add missing NEWS entry for r61263.
........
r61273 | georg.brandl | 2008-03-06 08:41:16 +0100 (Thu, 06 Mar 2008) | 2 lines
#2225: return nonzero status code from py_compile if not all files could be compiled.
........
r61274 | georg.brandl | 2008-03-06 08:43:02 +0100 (Thu, 06 Mar 2008) | 2 lines
#2220: handle matching failure more gracefully.
........
r61275 | georg.brandl | 2008-03-06 08:45:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Bug #2220: handle rlcompleter attribute match failure more gracefully.
........
r61278 | martin.v.loewis | 2008-03-06 14:49:47 +0100 (Thu, 06 Mar 2008) | 1 line
Rely on x64 platform configuration when building _bsddb on AMD64.
........
r61279 | martin.v.loewis | 2008-03-06 14:50:28 +0100 (Thu, 06 Mar 2008) | 1 line
Update db-4.4.20 build procedure.
........
r61285 | raymond.hettinger | 2008-03-06 21:52:01 +0100 (Thu, 06 Mar 2008) | 1 line
More tests.
........
r61286 | raymond.hettinger | 2008-03-06 23:51:36 +0100 (Thu, 06 Mar 2008) | 1 line
Issue 2246: itertools grouper object did not participate in GC (should be backported).
........
r61288 | raymond.hettinger | 2008-03-07 02:33:20 +0100 (Fri, 07 Mar 2008) | 1 line
Tweak recipes and tests
........
r61289 | jeffrey.yasskin | 2008-03-07 07:22:15 +0100 (Fri, 07 Mar 2008) | 5 lines
Progress on issue #1193577 by adding a polling .shutdown() method to
SocketServers. The core of the patch was written by Pedro Werneck, but any bugs
are mine. I've also rearranged the code for timeouts in order to avoid
interfering with the shutdown poll.
........
r61290 | nick.coghlan | 2008-03-07 15:13:28 +0100 (Fri, 07 Mar 2008) | 1 line
Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files)
........
r61298 | andrew.kuchling | 2008-03-07 22:09:23 +0100 (Fri, 07 Mar 2008) | 1 line
Grammar fix
........
r61303 | georg.brandl | 2008-03-08 10:54:06 +0100 (Sat, 08 Mar 2008) | 2 lines
#2253: fix continue vs. finally docs.
........
r61304 | marc-andre.lemburg | 2008-03-08 11:01:43 +0100 (Sat, 08 Mar 2008) | 3 lines
Add new name for Mandrake: Mandriva.
........
r61305 | georg.brandl | 2008-03-08 11:05:24 +0100 (Sat, 08 Mar 2008) | 2 lines
#1533486: fix types in refcount intro.
........
r61312 | facundo.batista | 2008-03-08 17:50:27 +0100 (Sat, 08 Mar 2008) | 5 lines
Issue 1106316. post_mortem()'s parameter, traceback, is now
optional: it defaults to the traceback of the exception that is currently
being handled.
........
r61313 | jeffrey.yasskin | 2008-03-08 19:26:54 +0100 (Sat, 08 Mar 2008) | 2 lines
Add tests for with and finally performance to pybench.
........
r61314 | jeffrey.yasskin | 2008-03-08 21:08:21 +0100 (Sat, 08 Mar 2008) | 2 lines
Fix pybench for pythons < 2.6, tested back to 2.3.
........
r61317 | jeffrey.yasskin | 2008-03-08 22:35:15 +0100 (Sat, 08 Mar 2008) | 3 lines
Well that was dumb. platform.python_implementation returns a function, not a
string.
........
r61329 | georg.brandl | 2008-03-09 16:11:39 +0100 (Sun, 09 Mar 2008) | 2 lines
#2249: document assertTrue and assertFalse.
........
r61332 | neal.norwitz | 2008-03-09 20:03:42 +0100 (Sun, 09 Mar 2008) | 4 lines
Introduce a lock to fix a race condition which caused an exception in the test.
Some buildbots were consistently failing (e.g., amd64).
Also remove a couple of semi-colons.
........
r61344 | raymond.hettinger | 2008-03-11 01:19:07 +0100 (Tue, 11 Mar 2008) | 1 line
Add recipe to docs.
........
r61350 | guido.van.rossum | 2008-03-11 22:18:06 +0100 (Tue, 11 Mar 2008) | 3 lines
Fix the overflows in expandtabs(). "This time for sure!"
(Exploit at request.)
........
r61351 | raymond.hettinger | 2008-03-11 22:37:46 +0100 (Tue, 11 Mar 2008) | 1 line
Improve docs for itemgetter(). Show that it works with slices.
........
r61363 | georg.brandl | 2008-03-13 08:15:56 +0100 (Thu, 13 Mar 2008) | 2 lines
#2265: fix example.
........
r61364 | georg.brandl | 2008-03-13 08:17:14 +0100 (Thu, 13 Mar 2008) | 2 lines
#2270: fix typo.
........
r61365 | georg.brandl | 2008-03-13 08:21:41 +0100 (Thu, 13 Mar 2008) | 2 lines
#1720705: add docs about import/threading interaction, wording by Nick.
........
r61366 | andrew.kuchling | 2008-03-13 12:07:35 +0100 (Thu, 13 Mar 2008) | 1 line
Add class decorators
........
r61367 | raymond.hettinger | 2008-03-13 17:43:17 +0100 (Thu, 13 Mar 2008) | 1 line
Add 2-to-3 support for the itertools moved to builtins or renamed.
........
r61368 | raymond.hettinger | 2008-03-13 17:43:59 +0100 (Thu, 13 Mar 2008) | 1 line
Consistent tense.
........
r61369 | raymond.hettinger | 2008-03-13 20:03:51 +0100 (Thu, 13 Mar 2008) | 1 line
Issue 2274: Add heapq.heappushpop().
........
r61370 | raymond.hettinger | 2008-03-13 20:33:34 +0100 (Thu, 13 Mar 2008) | 1 line
Simplify the nlargest() code using heappushpop().
........
r61371 | brett.cannon | 2008-03-13 21:27:00 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_thread over to unittest. Commits GHOP 237.
Thanks Benjamin Peterson for the patch.
........
r61372 | brett.cannon | 2008-03-13 21:33:10 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_tokenize to doctest.
Done as GHOP 238 by Josip Dzolonga.
........
r61373 | brett.cannon | 2008-03-13 21:47:41 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_contains, test_crypt, and test_select to unittest.
Patch from GHOP 294 by David Marek.
........
r61374 | brett.cannon | 2008-03-13 22:02:16 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_gdbm to use unittest.
Closes issue #1960. Thanks Giampaolo Rodola.
........
r61375 | brett.cannon | 2008-03-13 22:09:28 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_fcntl to unittest.
Closes issue #2055. Thanks Giampaolo Rodola.
........
r61376 | raymond.hettinger | 2008-03-14 06:03:44 +0100 (Fri, 14 Mar 2008) | 1 line
Leave heapreplace() unchanged.
........
r61378 | martin.v.loewis | 2008-03-14 14:56:09 +0100 (Fri, 14 Mar 2008) | 2 lines
Patch #2284: add -x64 option to rt.bat.
........
r61379 | martin.v.loewis | 2008-03-14 14:57:59 +0100 (Fri, 14 Mar 2008) | 2 lines
Use -x64 flag.
........
r61382 | brett.cannon | 2008-03-14 15:03:10 +0100 (Fri, 14 Mar 2008) | 2 lines
Remove a bad test.
........
r61383 | mark.dickinson | 2008-03-14 15:23:37 +0100 (Fri, 14 Mar 2008) | 9 lines
Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
across platforms: it should now raise OverflowError on all
platforms. (Previously it raised OverflowError only on
non IEEE 754 platforms.)
Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
........
r61387 | thomas.heller | 2008-03-14 22:06:21 +0100 (Fri, 14 Mar 2008) | 1 line
Remove unneeded initializer.
........
r61388 | martin.v.loewis | 2008-03-14 22:19:28 +0100 (Fri, 14 Mar 2008) | 2 lines
Run debug version, cd to PCbuild.
........
r61392 | georg.brandl | 2008-03-15 00:10:34 +0100 (Sat, 15 Mar 2008) | 2 lines
Remove obsolete paragraph. #2288.
........
r61395 | georg.brandl | 2008-03-15 01:20:19 +0100 (Sat, 15 Mar 2008) | 2 lines
Fix lots of broken links in the docs, found by Sphinx' external link checker.
........
r61396 | skip.montanaro | 2008-03-15 03:32:49 +0100 (Sat, 15 Mar 2008) | 1 line
note that fork and forkpty raise OSError on failure
........
r61402 | skip.montanaro | 2008-03-15 17:04:45 +0100 (Sat, 15 Mar 2008) | 1 line
add %f format to datetime - issue 1158
........
r61403 | skip.montanaro | 2008-03-15 17:07:11 +0100 (Sat, 15 Mar 2008) | 2 lines
.
........
2008-03-15 21:07:10 -03:00
|
|
|
parent. If an error occurs :exc:`OSError` is raised.
|
2008-10-10 19:20:52 -03:00
|
|
|
|
2014-03-16 01:13:56 -03:00
|
|
|
Note that some platforms including FreeBSD <= 6.3 and Cygwin have
|
2019-11-15 12:56:03 -04:00
|
|
|
known issues when using ``fork()`` from a thread.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.fork "" os.fork
|
|
|
|
|
2023-09-23 02:04:20 -03:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
If you use TLS sockets in an application calling ``fork()``, see
|
|
|
|
the warning in the :mod:`ssl` documentation.
|
|
|
|
|
2019-11-15 12:56:03 -04:00
|
|
|
.. versionchanged:: 3.8
|
|
|
|
Calling ``fork()`` in a subinterpreter is no longer supported
|
|
|
|
(:exc:`RuntimeError` is raised).
|
2008-10-10 19:20:52 -03:00
|
|
|
|
2023-09-23 02:04:20 -03:00
|
|
|
.. versionchanged:: 3.12
|
|
|
|
If Python is able to detect that your process has multiple
|
|
|
|
threads, :func:`os.fork` now raises a :exc:`DeprecationWarning`.
|
2013-10-29 17:08:56 -03:00
|
|
|
|
2023-09-23 02:04:20 -03:00
|
|
|
We chose to surface this as a warning, when detectable, to better
|
|
|
|
inform developers of a design problem that the POSIX platform
|
|
|
|
specifically notes as not supported. Even in code that
|
|
|
|
*appears* to work, it has never been safe to mix threading with
|
|
|
|
:func:`os.fork` on POSIX platforms. The CPython runtime itself has
|
|
|
|
always made API calls that are not safe for use in the child
|
|
|
|
process when threads existed in the parent (such as ``malloc`` and
|
|
|
|
``free``).
|
2013-10-29 17:08:56 -03:00
|
|
|
|
2023-09-23 02:04:20 -03:00
|
|
|
Users of macOS or users of libc or malloc implementations other
|
|
|
|
than those typically found in glibc to date are among those
|
|
|
|
already more likely to experience deadlocks running such code.
|
|
|
|
|
|
|
|
See `this discussion on fork being incompatible with threads
|
|
|
|
<https://discuss.python.org/t/33555>`_
|
|
|
|
for technical details of why we're surfacing this longstanding
|
|
|
|
platform compatibility problem to developers.
|
|
|
|
|
|
|
|
.. availability:: POSIX, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: forkpty()
|
|
|
|
|
|
|
|
Fork a child process, using a new pseudo-terminal as the child's controlling
|
|
|
|
terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, the
|
|
|
|
new child's process id in the parent, and *fd* is the file descriptor of the
|
|
|
|
master end of the pseudo-terminal. For a more portable approach, use the
|
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61239 | andrew.kuchling | 2008-03-05 01:44:41 +0100 (Wed, 05 Mar 2008) | 1 line
Add more items; add fragmentary notes
........
r61240 | amaury.forgeotdarc | 2008-03-05 02:50:33 +0100 (Wed, 05 Mar 2008) | 13 lines
Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::
>>> f(**g(1=2))
XXX undetected error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
instead of the expected SyntaxError: keyword can't be an expression
Will backport.
........
r61241 | neal.norwitz | 2008-03-05 06:10:48 +0100 (Wed, 05 Mar 2008) | 3 lines
Remove the files/dirs after closing the DB so the tests work on Windows.
Patch from Trent Nelson. Also simplified removing a file by using test_support.
........
r61242 | neal.norwitz | 2008-03-05 06:14:18 +0100 (Wed, 05 Mar 2008) | 3 lines
Get this test to pass even when there is no sound card in the system.
Patch from Trent Nelson. (I can't test this.)
........
r61243 | neal.norwitz | 2008-03-05 06:20:44 +0100 (Wed, 05 Mar 2008) | 3 lines
Catch OSError when trying to remove a file in case removal fails. This
should prevent a failure in tearDown masking any real test failure.
........
r61244 | neal.norwitz | 2008-03-05 06:38:06 +0100 (Wed, 05 Mar 2008) | 5 lines
Make the timeout longer to give slow machines a chance to pass the test
before timing out. This doesn't change the duration of the test under
normal circumstances. This is targetted at fixing the spurious failures
on the FreeBSD buildbot primarily.
........
r61245 | neal.norwitz | 2008-03-05 06:49:03 +0100 (Wed, 05 Mar 2008) | 1 line
Tabs -> spaces
........
r61246 | neal.norwitz | 2008-03-05 06:50:20 +0100 (Wed, 05 Mar 2008) | 1 line
Use -u urlfetch to run more tests
........
r61247 | neal.norwitz | 2008-03-05 06:51:20 +0100 (Wed, 05 Mar 2008) | 1 line
test_smtplib sometimes reports leaks too, suppress it
........
r61248 | jeffrey.yasskin | 2008-03-05 07:19:56 +0100 (Wed, 05 Mar 2008) | 5 lines
Fix test_socketserver on Windows after r61099 added several signal.alarm()
calls (which don't exist on non-Unix platforms).
Thanks to Trent Nelson for the report and patch.
........
r61249 | georg.brandl | 2008-03-05 08:10:35 +0100 (Wed, 05 Mar 2008) | 2 lines
Fix some rst.
........
r61252 | thomas.heller | 2008-03-05 15:53:39 +0100 (Wed, 05 Mar 2008) | 2 lines
News entry for yesterdays commit.
........
r61253 | thomas.heller | 2008-03-05 16:34:29 +0100 (Wed, 05 Mar 2008) | 3 lines
Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
........
r61254 | skip.montanaro | 2008-03-05 17:41:09 +0100 (Wed, 05 Mar 2008) | 4 lines
Elaborate on the role of the altinstall target when installing multiple
versions.
........
r61255 | georg.brandl | 2008-03-05 20:31:44 +0100 (Wed, 05 Mar 2008) | 2 lines
#2239: PYTHONPATH delimiter is os.pathsep.
........
r61256 | raymond.hettinger | 2008-03-05 21:59:58 +0100 (Wed, 05 Mar 2008) | 1 line
C implementation of itertools.permutations().
........
r61257 | raymond.hettinger | 2008-03-05 22:04:32 +0100 (Wed, 05 Mar 2008) | 1 line
Small code cleanup.
........
r61260 | martin.v.loewis | 2008-03-05 23:24:31 +0100 (Wed, 05 Mar 2008) | 2 lines
cd PCbuild only after deleting all pyc files.
........
r61261 | raymond.hettinger | 2008-03-06 02:15:52 +0100 (Thu, 06 Mar 2008) | 1 line
Add examples.
........
r61262 | andrew.kuchling | 2008-03-06 02:36:27 +0100 (Thu, 06 Mar 2008) | 1 line
Add two items
........
r61263 | georg.brandl | 2008-03-06 07:47:18 +0100 (Thu, 06 Mar 2008) | 2 lines
#1725737: ignore other VC directories other than CVS and SVN's too.
........
r61264 | martin.v.loewis | 2008-03-06 07:55:22 +0100 (Thu, 06 Mar 2008) | 4 lines
Patch #2232: os.tmpfile might fail on Windows if the user has no
permission to create files in the root directory.
Will backport to 2.5.
........
r61269 | georg.brandl | 2008-03-06 08:19:15 +0100 (Thu, 06 Mar 2008) | 2 lines
Expand on re.split behavior with captured expressions.
........
r61270 | georg.brandl | 2008-03-06 08:22:09 +0100 (Thu, 06 Mar 2008) | 2 lines
Little clarification of assignments.
........
r61271 | georg.brandl | 2008-03-06 08:31:34 +0100 (Thu, 06 Mar 2008) | 2 lines
Add isinstance/issubclass to tutorial.
........
r61272 | georg.brandl | 2008-03-06 08:34:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Add missing NEWS entry for r61263.
........
r61273 | georg.brandl | 2008-03-06 08:41:16 +0100 (Thu, 06 Mar 2008) | 2 lines
#2225: return nonzero status code from py_compile if not all files could be compiled.
........
r61274 | georg.brandl | 2008-03-06 08:43:02 +0100 (Thu, 06 Mar 2008) | 2 lines
#2220: handle matching failure more gracefully.
........
r61275 | georg.brandl | 2008-03-06 08:45:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Bug #2220: handle rlcompleter attribute match failure more gracefully.
........
r61278 | martin.v.loewis | 2008-03-06 14:49:47 +0100 (Thu, 06 Mar 2008) | 1 line
Rely on x64 platform configuration when building _bsddb on AMD64.
........
r61279 | martin.v.loewis | 2008-03-06 14:50:28 +0100 (Thu, 06 Mar 2008) | 1 line
Update db-4.4.20 build procedure.
........
r61285 | raymond.hettinger | 2008-03-06 21:52:01 +0100 (Thu, 06 Mar 2008) | 1 line
More tests.
........
r61286 | raymond.hettinger | 2008-03-06 23:51:36 +0100 (Thu, 06 Mar 2008) | 1 line
Issue 2246: itertools grouper object did not participate in GC (should be backported).
........
r61288 | raymond.hettinger | 2008-03-07 02:33:20 +0100 (Fri, 07 Mar 2008) | 1 line
Tweak recipes and tests
........
r61289 | jeffrey.yasskin | 2008-03-07 07:22:15 +0100 (Fri, 07 Mar 2008) | 5 lines
Progress on issue #1193577 by adding a polling .shutdown() method to
SocketServers. The core of the patch was written by Pedro Werneck, but any bugs
are mine. I've also rearranged the code for timeouts in order to avoid
interfering with the shutdown poll.
........
r61290 | nick.coghlan | 2008-03-07 15:13:28 +0100 (Fri, 07 Mar 2008) | 1 line
Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files)
........
r61298 | andrew.kuchling | 2008-03-07 22:09:23 +0100 (Fri, 07 Mar 2008) | 1 line
Grammar fix
........
r61303 | georg.brandl | 2008-03-08 10:54:06 +0100 (Sat, 08 Mar 2008) | 2 lines
#2253: fix continue vs. finally docs.
........
r61304 | marc-andre.lemburg | 2008-03-08 11:01:43 +0100 (Sat, 08 Mar 2008) | 3 lines
Add new name for Mandrake: Mandriva.
........
r61305 | georg.brandl | 2008-03-08 11:05:24 +0100 (Sat, 08 Mar 2008) | 2 lines
#1533486: fix types in refcount intro.
........
r61312 | facundo.batista | 2008-03-08 17:50:27 +0100 (Sat, 08 Mar 2008) | 5 lines
Issue 1106316. post_mortem()'s parameter, traceback, is now
optional: it defaults to the traceback of the exception that is currently
being handled.
........
r61313 | jeffrey.yasskin | 2008-03-08 19:26:54 +0100 (Sat, 08 Mar 2008) | 2 lines
Add tests for with and finally performance to pybench.
........
r61314 | jeffrey.yasskin | 2008-03-08 21:08:21 +0100 (Sat, 08 Mar 2008) | 2 lines
Fix pybench for pythons < 2.6, tested back to 2.3.
........
r61317 | jeffrey.yasskin | 2008-03-08 22:35:15 +0100 (Sat, 08 Mar 2008) | 3 lines
Well that was dumb. platform.python_implementation returns a function, not a
string.
........
r61329 | georg.brandl | 2008-03-09 16:11:39 +0100 (Sun, 09 Mar 2008) | 2 lines
#2249: document assertTrue and assertFalse.
........
r61332 | neal.norwitz | 2008-03-09 20:03:42 +0100 (Sun, 09 Mar 2008) | 4 lines
Introduce a lock to fix a race condition which caused an exception in the test.
Some buildbots were consistently failing (e.g., amd64).
Also remove a couple of semi-colons.
........
r61344 | raymond.hettinger | 2008-03-11 01:19:07 +0100 (Tue, 11 Mar 2008) | 1 line
Add recipe to docs.
........
r61350 | guido.van.rossum | 2008-03-11 22:18:06 +0100 (Tue, 11 Mar 2008) | 3 lines
Fix the overflows in expandtabs(). "This time for sure!"
(Exploit at request.)
........
r61351 | raymond.hettinger | 2008-03-11 22:37:46 +0100 (Tue, 11 Mar 2008) | 1 line
Improve docs for itemgetter(). Show that it works with slices.
........
r61363 | georg.brandl | 2008-03-13 08:15:56 +0100 (Thu, 13 Mar 2008) | 2 lines
#2265: fix example.
........
r61364 | georg.brandl | 2008-03-13 08:17:14 +0100 (Thu, 13 Mar 2008) | 2 lines
#2270: fix typo.
........
r61365 | georg.brandl | 2008-03-13 08:21:41 +0100 (Thu, 13 Mar 2008) | 2 lines
#1720705: add docs about import/threading interaction, wording by Nick.
........
r61366 | andrew.kuchling | 2008-03-13 12:07:35 +0100 (Thu, 13 Mar 2008) | 1 line
Add class decorators
........
r61367 | raymond.hettinger | 2008-03-13 17:43:17 +0100 (Thu, 13 Mar 2008) | 1 line
Add 2-to-3 support for the itertools moved to builtins or renamed.
........
r61368 | raymond.hettinger | 2008-03-13 17:43:59 +0100 (Thu, 13 Mar 2008) | 1 line
Consistent tense.
........
r61369 | raymond.hettinger | 2008-03-13 20:03:51 +0100 (Thu, 13 Mar 2008) | 1 line
Issue 2274: Add heapq.heappushpop().
........
r61370 | raymond.hettinger | 2008-03-13 20:33:34 +0100 (Thu, 13 Mar 2008) | 1 line
Simplify the nlargest() code using heappushpop().
........
r61371 | brett.cannon | 2008-03-13 21:27:00 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_thread over to unittest. Commits GHOP 237.
Thanks Benjamin Peterson for the patch.
........
r61372 | brett.cannon | 2008-03-13 21:33:10 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_tokenize to doctest.
Done as GHOP 238 by Josip Dzolonga.
........
r61373 | brett.cannon | 2008-03-13 21:47:41 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_contains, test_crypt, and test_select to unittest.
Patch from GHOP 294 by David Marek.
........
r61374 | brett.cannon | 2008-03-13 22:02:16 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_gdbm to use unittest.
Closes issue #1960. Thanks Giampaolo Rodola.
........
r61375 | brett.cannon | 2008-03-13 22:09:28 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_fcntl to unittest.
Closes issue #2055. Thanks Giampaolo Rodola.
........
r61376 | raymond.hettinger | 2008-03-14 06:03:44 +0100 (Fri, 14 Mar 2008) | 1 line
Leave heapreplace() unchanged.
........
r61378 | martin.v.loewis | 2008-03-14 14:56:09 +0100 (Fri, 14 Mar 2008) | 2 lines
Patch #2284: add -x64 option to rt.bat.
........
r61379 | martin.v.loewis | 2008-03-14 14:57:59 +0100 (Fri, 14 Mar 2008) | 2 lines
Use -x64 flag.
........
r61382 | brett.cannon | 2008-03-14 15:03:10 +0100 (Fri, 14 Mar 2008) | 2 lines
Remove a bad test.
........
r61383 | mark.dickinson | 2008-03-14 15:23:37 +0100 (Fri, 14 Mar 2008) | 9 lines
Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
across platforms: it should now raise OverflowError on all
platforms. (Previously it raised OverflowError only on
non IEEE 754 platforms.)
Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
........
r61387 | thomas.heller | 2008-03-14 22:06:21 +0100 (Fri, 14 Mar 2008) | 1 line
Remove unneeded initializer.
........
r61388 | martin.v.loewis | 2008-03-14 22:19:28 +0100 (Fri, 14 Mar 2008) | 2 lines
Run debug version, cd to PCbuild.
........
r61392 | georg.brandl | 2008-03-15 00:10:34 +0100 (Sat, 15 Mar 2008) | 2 lines
Remove obsolete paragraph. #2288.
........
r61395 | georg.brandl | 2008-03-15 01:20:19 +0100 (Sat, 15 Mar 2008) | 2 lines
Fix lots of broken links in the docs, found by Sphinx' external link checker.
........
r61396 | skip.montanaro | 2008-03-15 03:32:49 +0100 (Sat, 15 Mar 2008) | 1 line
note that fork and forkpty raise OSError on failure
........
r61402 | skip.montanaro | 2008-03-15 17:04:45 +0100 (Sat, 15 Mar 2008) | 1 line
add %f format to datetime - issue 1158
........
r61403 | skip.montanaro | 2008-03-15 17:07:11 +0100 (Sat, 15 Mar 2008) | 2 lines
.
........
2008-03-15 21:07:10 -03:00
|
|
|
:mod:`pty` module. If an error occurs :exc:`OSError` is raised.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.forkpty "" os.forkpty
|
|
|
|
|
2023-09-23 02:04:20 -03:00
|
|
|
.. versionchanged:: 3.12
|
|
|
|
If Python is able to detect that your process has multiple
|
|
|
|
threads, this now raises a :exc:`DeprecationWarning`. See the
|
|
|
|
longer explanation on :func:`os.fork`.
|
|
|
|
|
2019-11-15 12:56:03 -04:00
|
|
|
.. versionchanged:: 3.8
|
|
|
|
Calling ``forkpty()`` in a subinterpreter is no longer supported
|
|
|
|
(:exc:`RuntimeError` is raised).
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: kill(pid, sig, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. index::
|
|
|
|
single: process; killing
|
|
|
|
single: process; signalling
|
|
|
|
|
|
|
|
Send signal *sig* to the process *pid*. Constants for the specific signals
|
|
|
|
available on the host platform are defined in the :mod:`signal` module.
|
2010-04-12 14:16:38 -03:00
|
|
|
|
2023-07-21 06:40:37 -03:00
|
|
|
Windows: The :const:`signal.CTRL_C_EVENT` and
|
|
|
|
:const:`signal.CTRL_BREAK_EVENT` signals are special signals which can
|
2010-04-12 14:16:38 -03:00
|
|
|
only be sent to console processes which share a common console window,
|
|
|
|
e.g., some subprocesses. Any other value for *sig* will cause the process
|
|
|
|
to be unconditionally killed by the TerminateProcess API, and the exit code
|
|
|
|
will be set to *sig*. The Windows version of :func:`kill` additionally takes
|
|
|
|
process handles to be killed.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-05-07 20:46:11 -03:00
|
|
|
See also :func:`signal.pthread_kill`.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.kill pid,sig os.kill
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, Windows, not Emscripten, not WASI.
|
|
|
|
|
2010-08-17 12:07:14 -03:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
Windows support.
|
2010-04-20 12:28:06 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: killpg(pgid, sig, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. index::
|
|
|
|
single: process; killing
|
|
|
|
single: process; signalling
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Send the signal *sig* to the process group *pgid*.
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
.. audit-event:: os.killpg pgid,sig os.killpg
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: nice(increment, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Add *increment* to the process's "niceness". Return the new niceness.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2019-11-05 23:21:29 -04:00
|
|
|
.. function:: pidfd_open(pid, flags=0)
|
|
|
|
|
2022-05-31 07:51:29 -03:00
|
|
|
Return a file descriptor referring to the process *pid* with *flags* set.
|
|
|
|
This descriptor can be used to perform process management without races
|
|
|
|
and signals.
|
2019-11-05 23:21:29 -04:00
|
|
|
|
|
|
|
See the :manpage:`pidfd_open(2)` man page for more details.
|
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 5.3
|
2019-11-05 23:21:29 -04:00
|
|
|
.. versionadded:: 3.9
|
|
|
|
|
2022-05-31 07:51:29 -03:00
|
|
|
.. data:: PIDFD_NONBLOCK
|
|
|
|
|
|
|
|
This flag indicates that the file descriptor will be non-blocking.
|
|
|
|
If the process referred to by the file descriptor has not yet terminated,
|
|
|
|
then an attempt to wait on the file descriptor using :manpage:`waitid(2)`
|
2023-07-21 06:40:37 -03:00
|
|
|
will immediately return the error :const:`~errno.EAGAIN` rather than blocking.
|
2022-05-31 07:51:29 -03:00
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 5.10
|
2022-05-31 07:51:29 -03:00
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
2019-11-05 23:21:29 -04:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: plock(op, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Lock program segments into memory. The value of *op* (defined in
|
2010-05-06 20:03:05 -03:00
|
|
|
``<sys/lock.h>``) determines which segments are locked.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-05-18 23:42:43 -03:00
|
|
|
.. function:: popen(cmd, mode='r', buffering=-1)
|
2014-04-16 10:10:53 -03:00
|
|
|
|
2015-09-08 22:01:13 -03:00
|
|
|
Open a pipe to or from command *cmd*.
|
|
|
|
The return value is an open file object
|
2014-04-16 10:10:53 -03:00
|
|
|
connected to the pipe, which can be read or written depending on whether *mode*
|
2022-05-06 02:48:36 -03:00
|
|
|
is ``'r'`` (default) or ``'w'``.
|
2022-05-18 23:42:43 -03:00
|
|
|
The *buffering* argument have the same meaning as
|
2014-04-16 10:10:53 -03:00
|
|
|
the corresponding argument to the built-in :func:`open` function. The
|
|
|
|
returned file object reads or writes text strings rather than bytes.
|
|
|
|
|
|
|
|
The ``close`` method returns :const:`None` if the subprocess exited
|
|
|
|
successfully, or the subprocess's return code if there was an
|
|
|
|
error. On POSIX systems, if the return code is positive it
|
|
|
|
represents the return value of the process left-shifted by one
|
|
|
|
byte. If the return code is negative, the process was terminated
|
|
|
|
by the signal given by the negated value of the return code. (For
|
|
|
|
example, the return value might be ``- signal.SIGKILL`` if the
|
|
|
|
subprocess was killed.) On Windows systems, the return value
|
|
|
|
contains the signed integer return code from the child process.
|
|
|
|
|
2020-04-01 13:49:29 -03:00
|
|
|
On Unix, :func:`waitstatus_to_exitcode` can be used to convert the ``close``
|
|
|
|
method result (exit status) into an exit code if it is not ``None``. On
|
|
|
|
Windows, the ``close`` method result is directly the exit code
|
|
|
|
(or ``None``).
|
|
|
|
|
2014-04-16 10:10:53 -03:00
|
|
|
This is implemented using :class:`subprocess.Popen`; see that class's
|
|
|
|
documentation for more powerful ways to manage and communicate with
|
|
|
|
subprocesses.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: not Emscripten, not WASI.
|
|
|
|
|
2022-05-18 23:42:43 -03:00
|
|
|
.. note::
|
|
|
|
The :ref:`Python UTF-8 Mode <utf8-mode>` affects encodings used
|
|
|
|
for *cmd* and pipe contents.
|
|
|
|
|
|
|
|
:func:`popen` is a simple wrapper around :class:`subprocess.Popen`.
|
|
|
|
Use :class:`subprocess.Popen` or :func:`subprocess.run` to
|
|
|
|
control options like encodings.
|
2022-05-06 02:48:36 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-09-08 08:48:18 -03:00
|
|
|
.. function:: posix_spawn(path, argv, env, *, file_actions=None, \
|
2019-02-01 06:05:22 -04:00
|
|
|
setpgroup=None, resetids=False, setsid=False, setsigmask=(), \
|
2018-09-07 12:44:24 -03:00
|
|
|
setsigdef=(), scheduler=None)
|
2018-04-01 16:01:48 -03:00
|
|
|
|
2023-08-19 14:03:26 -03:00
|
|
|
Wraps the :c:func:`!posix_spawn` C library API for use from Python.
|
2018-04-01 16:01:48 -03:00
|
|
|
|
2018-05-01 10:45:04 -03:00
|
|
|
Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`.
|
2018-04-01 16:01:48 -03:00
|
|
|
|
2018-09-08 08:48:18 -03:00
|
|
|
The positional-only arguments *path*, *args*, and *env* are similar to
|
|
|
|
:func:`execve`.
|
2018-04-01 16:01:48 -03:00
|
|
|
|
2020-10-20 06:08:58 -03:00
|
|
|
The *path* parameter is the path to the executable file. The *path* should
|
|
|
|
contain a directory. Use :func:`posix_spawnp` to pass an executable file
|
2019-01-16 09:29:26 -04:00
|
|
|
without directory.
|
|
|
|
|
2018-04-01 16:01:48 -03:00
|
|
|
The *file_actions* argument may be a sequence of tuples describing actions
|
|
|
|
to take on specific file descriptors in the child process between the C
|
2018-05-01 10:45:04 -03:00
|
|
|
library implementation's :c:func:`fork` and :c:func:`exec` steps.
|
|
|
|
The first item in each tuple must be one of the three type indicator
|
|
|
|
listed below describing the remaining tuple elements:
|
2018-04-01 16:01:48 -03:00
|
|
|
|
2018-05-01 10:45:04 -03:00
|
|
|
.. data:: POSIX_SPAWN_OPEN
|
2018-04-01 16:01:48 -03:00
|
|
|
|
2018-05-01 10:45:04 -03:00
|
|
|
(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)
|
|
|
|
|
|
|
|
Performs ``os.dup2(os.open(path, flags, mode), fd)``.
|
|
|
|
|
|
|
|
.. data:: POSIX_SPAWN_CLOSE
|
|
|
|
|
|
|
|
(``os.POSIX_SPAWN_CLOSE``, *fd*)
|
|
|
|
|
|
|
|
Performs ``os.close(fd)``.
|
|
|
|
|
|
|
|
.. data:: POSIX_SPAWN_DUP2
|
|
|
|
|
|
|
|
(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)
|
|
|
|
|
|
|
|
Performs ``os.dup2(fd, new_fd)``.
|
|
|
|
|
|
|
|
These tuples correspond to the C library
|
2023-08-19 14:03:26 -03:00
|
|
|
:c:func:`!posix_spawn_file_actions_addopen`,
|
|
|
|
:c:func:`!posix_spawn_file_actions_addclose`, and
|
|
|
|
:c:func:`!posix_spawn_file_actions_adddup2` API calls used to prepare
|
|
|
|
for the :c:func:`!posix_spawn` call itself.
|
2018-04-01 16:01:48 -03:00
|
|
|
|
2018-09-07 12:44:24 -03:00
|
|
|
The *setpgroup* argument will set the process group of the child to the value
|
|
|
|
specified. If the value specified is 0, the child's process group ID will be
|
|
|
|
made the same as its process ID. If the value of *setpgroup* is not set, the
|
|
|
|
child will inherit the parent's process group ID. This argument corresponds
|
2023-08-19 14:03:26 -03:00
|
|
|
to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag.
|
2018-09-07 12:44:24 -03:00
|
|
|
|
|
|
|
If the *resetids* argument is ``True`` it will reset the effective UID and
|
|
|
|
GID of the child to the real UID and GID of the parent process. If the
|
|
|
|
argument is ``False``, then the child retains the effective UID and GID of
|
|
|
|
the parent. In either case, if the set-user-ID and set-group-ID permission
|
|
|
|
bits are enabled on the executable file, their effect will override the
|
|
|
|
setting of the effective UID and GID. This argument corresponds to the C
|
2023-08-19 14:03:26 -03:00
|
|
|
library :c:macro:`!POSIX_SPAWN_RESETIDS` flag.
|
2018-09-07 12:44:24 -03:00
|
|
|
|
2019-02-01 06:05:22 -04:00
|
|
|
If the *setsid* argument is ``True``, it will create a new session ID
|
2023-08-19 14:03:26 -03:00
|
|
|
for ``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID`
|
|
|
|
or :c:macro:`!POSIX_SPAWN_SETSID_NP` flag. Otherwise, :exc:`NotImplementedError`
|
2019-02-01 06:05:22 -04:00
|
|
|
is raised.
|
|
|
|
|
2018-09-07 12:44:24 -03:00
|
|
|
The *setsigmask* argument will set the signal mask to the signal set
|
|
|
|
specified. If the parameter is not used, then the child inherits the
|
|
|
|
parent's signal mask. This argument corresponds to the C library
|
2023-08-19 14:03:26 -03:00
|
|
|
:c:macro:`!POSIX_SPAWN_SETSIGMASK` flag.
|
2018-09-07 12:44:24 -03:00
|
|
|
|
|
|
|
The *sigdef* argument will reset the disposition of all signals in the set
|
|
|
|
specified. This argument corresponds to the C library
|
2023-08-19 14:03:26 -03:00
|
|
|
:c:macro:`!POSIX_SPAWN_SETSIGDEF` flag.
|
2018-09-07 12:44:24 -03:00
|
|
|
|
|
|
|
The *scheduler* argument must be a tuple containing the (optional) scheduler
|
|
|
|
policy and an instance of :class:`sched_param` with the scheduler parameters.
|
|
|
|
A value of ``None`` in the place of the scheduler policy indicates that is
|
|
|
|
not being provided. This argument is a combination of the C library
|
2023-08-19 14:03:26 -03:00
|
|
|
:c:macro:`!POSIX_SPAWN_SETSCHEDPARAM` and :c:macro:`!POSIX_SPAWN_SETSCHEDULER`
|
2018-09-07 12:44:24 -03:00
|
|
|
flags.
|
|
|
|
|
2020-02-04 20:15:00 -04:00
|
|
|
.. audit-event:: os.posix_spawn path,argv,env os.posix_spawn
|
|
|
|
|
2019-03-03 13:42:25 -04:00
|
|
|
.. versionadded:: 3.8
|
2018-04-01 16:01:48 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2018-04-01 16:01:48 -03:00
|
|
|
|
2019-01-16 09:29:26 -04:00
|
|
|
.. function:: posix_spawnp(path, argv, env, *, file_actions=None, \
|
2019-02-01 06:05:22 -04:00
|
|
|
setpgroup=None, resetids=False, setsid=False, setsigmask=(), \
|
2019-01-16 09:29:26 -04:00
|
|
|
setsigdef=(), scheduler=None)
|
|
|
|
|
2023-08-19 14:03:26 -03:00
|
|
|
Wraps the :c:func:`!posix_spawnp` C library API for use from Python.
|
2019-01-16 09:29:26 -04:00
|
|
|
|
|
|
|
Similar to :func:`posix_spawn` except that the system searches
|
|
|
|
for the *executable* file in the list of directories specified by the
|
|
|
|
:envvar:`PATH` environment variable (in the same way as for ``execvp(3)``).
|
|
|
|
|
2020-02-04 20:15:00 -04:00
|
|
|
.. audit-event:: os.posix_spawn path,argv,env os.posix_spawnp
|
|
|
|
|
2019-01-16 09:29:26 -04:00
|
|
|
.. versionadded:: 3.8
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: POSIX, not Emscripten, not WASI.
|
2022-07-29 11:42:09 -03:00
|
|
|
|
|
|
|
See :func:`posix_spawn` documentation.
|
2019-02-01 06:05:22 -04:00
|
|
|
|
2019-01-16 09:29:26 -04:00
|
|
|
|
2017-05-29 14:03:41 -03:00
|
|
|
.. function:: register_at_fork(*, before=None, after_in_parent=None, \
|
|
|
|
after_in_child=None)
|
2017-05-27 12:50:54 -03:00
|
|
|
|
2017-05-29 14:03:41 -03:00
|
|
|
Register callables to be executed when a new child process is forked
|
|
|
|
using :func:`os.fork` or similar process cloning APIs.
|
|
|
|
The parameters are optional and keyword-only.
|
|
|
|
Each specifies a different call point.
|
2017-05-27 12:50:54 -03:00
|
|
|
|
2017-05-29 14:03:41 -03:00
|
|
|
* *before* is a function called before forking a child process.
|
|
|
|
* *after_in_parent* is a function called from the parent process
|
|
|
|
after forking a child process.
|
|
|
|
* *after_in_child* is a function called from the child process.
|
|
|
|
|
|
|
|
These calls are only made if control is expected to return to the
|
|
|
|
Python interpreter. A typical :mod:`subprocess` launch will not
|
|
|
|
trigger them as the child is not going to re-enter the interpreter.
|
2017-05-27 12:50:54 -03:00
|
|
|
|
|
|
|
Functions registered for execution before forking are called in
|
|
|
|
reverse registration order. Functions registered for execution
|
|
|
|
after forking (either in the parent or in the child) are called
|
|
|
|
in registration order.
|
|
|
|
|
|
|
|
Note that :c:func:`fork` calls made by third-party C code may not
|
|
|
|
call those functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`,
|
|
|
|
:c:func:`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`.
|
|
|
|
|
2017-05-29 14:03:41 -03:00
|
|
|
There is no way to unregister a function.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2017-05-27 12:50:54 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.7
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: spawnl(mode, path, ...)
|
|
|
|
spawnle(mode, path, ..., env)
|
|
|
|
spawnlp(mode, file, ...)
|
|
|
|
spawnlpe(mode, file, ..., env)
|
|
|
|
spawnv(mode, path, args)
|
|
|
|
spawnve(mode, path, args, env)
|
|
|
|
spawnvp(mode, file, args)
|
|
|
|
spawnvpe(mode, file, args, env)
|
|
|
|
|
|
|
|
Execute the program *path* in a new process.
|
|
|
|
|
|
|
|
(Note that the :mod:`subprocess` module provides more powerful facilities for
|
|
|
|
spawning new processes and retrieving their results; using that module is
|
Merged revisions 73196,73278-73280,73299,73308,73312-73313,73317-73318,73321,73324,73331,73335,73340,73363 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73196 | benjamin.peterson | 2009-06-03 20:40:29 -0500 (Wed, 03 Jun 2009) | 1 line
use the offical api
........
r73278 | benjamin.peterson | 2009-06-07 17:33:11 -0500 (Sun, 07 Jun 2009) | 1 line
inherit from object
........
r73279 | benjamin.peterson | 2009-06-07 17:35:00 -0500 (Sun, 07 Jun 2009) | 1 line
always inherit from an appropiate base class
........
r73280 | benjamin.peterson | 2009-06-07 17:54:35 -0500 (Sun, 07 Jun 2009) | 1 line
use booleans for flags
........
r73299 | georg.brandl | 2009-06-08 13:41:36 -0500 (Mon, 08 Jun 2009) | 1 line
Typo fix.
........
r73308 | benjamin.peterson | 2009-06-08 17:18:32 -0500 (Mon, 08 Jun 2009) | 1 line
remove useless assertion
........
r73312 | benjamin.peterson | 2009-06-08 18:44:13 -0500 (Mon, 08 Jun 2009) | 1 line
remove error checks already done in set_context()
........
r73313 | r.david.murray | 2009-06-08 19:44:22 -0500 (Mon, 08 Jun 2009) | 4 lines
Issue 2947: document how return code handling translates from
os.popen to subprocess. Also fixes reference link in the
os.spawn documentation.
........
r73317 | benjamin.peterson | 2009-06-09 12:24:26 -0500 (Tue, 09 Jun 2009) | 1 line
make ast.c depend on the grammar
........
r73318 | benjamin.peterson | 2009-06-09 12:29:51 -0500 (Tue, 09 Jun 2009) | 1 line
explain why keyword names are not just NAME
........
r73321 | benjamin.peterson | 2009-06-09 16:13:43 -0500 (Tue, 09 Jun 2009) | 1 line
update symbol.py from with statement changes
........
r73324 | amaury.forgeotdarc | 2009-06-09 17:53:16 -0500 (Tue, 09 Jun 2009) | 2 lines
Avoid invoking the parser/compiler just to test the presence of a function.
........
r73331 | benjamin.peterson | 2009-06-10 08:45:31 -0500 (Wed, 10 Jun 2009) | 1 line
fix spelling
........
r73335 | raymond.hettinger | 2009-06-10 11:15:40 -0500 (Wed, 10 Jun 2009) | 1 line
Fix signed/unsigned compiler warning.
........
r73340 | amaury.forgeotdarc | 2009-06-10 15:30:19 -0500 (Wed, 10 Jun 2009) | 2 lines
Fix a typo spotted by Nick Coghlan.
........
r73363 | benjamin.peterson | 2009-06-11 12:51:17 -0500 (Thu, 11 Jun 2009) | 1 line
use multi-with syntax
........
2009-06-11 19:54:11 -03:00
|
|
|
preferable to using these functions. Check especially the
|
|
|
|
:ref:`subprocess-replacements` section.)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
If *mode* is :const:`P_NOWAIT`, this function returns the process id of the new
|
2007-08-15 11:28:22 -03:00
|
|
|
process; if *mode* is :const:`P_WAIT`, returns the process's exit code if it
|
|
|
|
exits normally, or ``-signal``, where *signal* is the signal that killed the
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
process. On Windows, the process id will actually be the process handle, so can
|
2007-08-15 11:28:22 -03:00
|
|
|
be used with the :func:`waitpid` function.
|
|
|
|
|
2019-05-21 07:46:37 -03:00
|
|
|
Note on VxWorks, this function doesn't return ``-signal`` when the new process is
|
|
|
|
killed. Instead it raises OSError exception.
|
|
|
|
|
2013-10-13 14:12:43 -03:00
|
|
|
The "l" and "v" variants of the :func:`spawn\* <spawnl>` functions differ in how
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
command-line arguments are passed. The "l" variants are perhaps the easiest
|
2007-08-15 11:28:22 -03:00
|
|
|
to work with if the number of parameters is fixed when the code is written; the
|
|
|
|
individual parameters simply become additional parameters to the
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
:func:`spawnl\*` functions. The "v" variants are good when the number of
|
2007-08-15 11:28:22 -03:00
|
|
|
parameters is variable, with the arguments being passed in a list or tuple as
|
|
|
|
the *args* parameter. In either case, the arguments to the child process must
|
|
|
|
start with the name of the command being run.
|
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
The variants which include a second "p" near the end (:func:`spawnlp`,
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the
|
|
|
|
:envvar:`PATH` environment variable to locate the program *file*. When the
|
2013-10-13 14:12:43 -03:00
|
|
|
environment is being replaced (using one of the :func:`spawn\*e <spawnl>` variants,
|
2007-08-15 11:28:22 -03:00
|
|
|
discussed in the next paragraph), the new environment is used as the source of
|
|
|
|
the :envvar:`PATH` variable. The other variants, :func:`spawnl`,
|
|
|
|
:func:`spawnle`, :func:`spawnv`, and :func:`spawnve`, will not use the
|
|
|
|
:envvar:`PATH` variable to locate the executable; *path* must contain an
|
|
|
|
appropriate absolute or relative path.
|
|
|
|
|
|
|
|
For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe`
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
(note that these all end in "e"), the *env* parameter must be a mapping
|
Merged revisions 62386-62387,62389-62393,62396,62400-62402,62407,62409-62410,62412-62414,62418-62419 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62386 | christian.heimes | 2008-04-19 04:23:57 +0200 (Sat, 19 Apr 2008) | 2 lines
Added kill, terminate and send_signal to subprocess.Popen
The bits and pieces for the Windows side were already in place. The POSIX side is trivial (as usual) and uses os.kill().
........
r62387 | georg.brandl | 2008-04-19 10:23:59 +0200 (Sat, 19 Apr 2008) | 2 lines
Fix-up docs for revision 62386.
........
r62389 | georg.brandl | 2008-04-19 18:57:43 +0200 (Sat, 19 Apr 2008) | 2 lines
#2369: clarify that copyfile() doesn't take a target directory.
........
r62390 | georg.brandl | 2008-04-19 18:58:28 +0200 (Sat, 19 Apr 2008) | 2 lines
#2634: clarify meaning of env parameter to spawn/exec*e.
........
r62391 | georg.brandl | 2008-04-19 18:58:49 +0200 (Sat, 19 Apr 2008) | 2 lines
#2633: clarify meaning of env parameter.
........
r62392 | georg.brandl | 2008-04-19 18:59:16 +0200 (Sat, 19 Apr 2008) | 2 lines
#2631: clarify IMPORT_NAME semantics.
........
r62393 | georg.brandl | 2008-04-19 19:00:14 +0200 (Sat, 19 Apr 2008) | 2 lines
:func: et al. should *not* include the parens.
........
r62396 | mark.dickinson | 2008-04-19 20:51:48 +0200 (Sat, 19 Apr 2008) | 5 lines
Additional tests for math.pow, and extra special-case
handling code in math.pow, in the hope of making all
tests pass on the alpha Tru64 buildbot.
........
r62400 | mark.dickinson | 2008-04-19 21:41:52 +0200 (Sat, 19 Apr 2008) | 3 lines
Additional special-case handling for math.pow.
Windows/VS2008 doesn't like (-1)**(+-inf).
........
r62401 | benjamin.peterson | 2008-04-19 21:47:34 +0200 (Sat, 19 Apr 2008) | 2 lines
Complete documentation for errors argument of io's open and TextIOWrapper
........
r62402 | mark.dickinson | 2008-04-19 22:31:16 +0200 (Sat, 19 Apr 2008) | 2 lines
Document updates to math and cmath modules.
........
r62407 | georg.brandl | 2008-04-19 23:28:38 +0200 (Sat, 19 Apr 2008) | 2 lines
Update template for newest Sphinx.
........
r62409 | mark.dickinson | 2008-04-19 23:35:35 +0200 (Sat, 19 Apr 2008) | 5 lines
Correct documentation for math.pow;
0**nan is nan, not 0. (But nan**0 and 1**nan are 1.)
Also fix minor typo: 'quite NaN' -> 'quiet NaN'
........
r62410 | mark.dickinson | 2008-04-19 23:49:22 +0200 (Sat, 19 Apr 2008) | 4 lines
Move asinh documentation to the proper place.
Remove meaningless 'in radians' from inverse
hyperbolic functions.
........
r62412 | mark.dickinson | 2008-04-20 03:22:30 +0200 (Sun, 20 Apr 2008) | 5 lines
Report additional diagnostic information in
test_math, to help track down debian-alpha
buildbot failure.
........
r62413 | mark.dickinson | 2008-04-20 03:39:24 +0200 (Sun, 20 Apr 2008) | 3 lines
FreeBSD doesn't follow C99 for modf(inf); so add explicit
special-value handling to math.modf code.
........
r62414 | mark.dickinson | 2008-04-20 06:13:13 +0200 (Sun, 20 Apr 2008) | 5 lines
Yet more explicit special case handling to make
math.pow behave on alpha Tru64. All IEEE 754
special values are now handled directly; only
the finite**finite case is handled by libm.
........
r62418 | mark.dickinson | 2008-04-20 18:13:17 +0200 (Sun, 20 Apr 2008) | 7 lines
Issue 2662: Initialize special value tables dynamically (i.e. when
cmath module is loaded) instead of statically. This fixes compile-time
problems on platforms where HUGE_VAL is an extern variable rather than
a constant.
Thanks Hirokazu Yamamoto for the patch.
........
r62419 | andrew.kuchling | 2008-04-20 18:54:02 +0200 (Sun, 20 Apr 2008) | 1 line
Move description of math module changes; various edits to description of cmath changes
........
2008-04-20 18:01:16 -03:00
|
|
|
which is used to define the environment variables for the new process (they are
|
|
|
|
used instead of the current process' environment); the functions
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`spawnl`, :func:`spawnlp`, :func:`spawnv`, and :func:`spawnvp` all cause
|
Merged revisions 70712,70714,70764-70765,70769-70771,70773,70776-70777,70788-70789,70824,70828,70832,70836,70842,70851,70855,70857,70866-70872,70883,70885,70893-70894,70896-70897,70903,70905-70907,70915,70927,70933,70951,70960,70962-70964,70998,71001,71006,71008,71010-71011,71019,71037,71056,71094,71101-71103,71106,71119,71123,71149-71150,71203,71212,71214-71217,71221,71240 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70712 | benjamin.peterson | 2009-03-30 10:15:38 -0500 (Mon, 30 Mar 2009) | 1 line
don't rely on the order dict repr #5605
........
r70714 | brett.cannon | 2009-03-30 10:20:53 -0500 (Mon, 30 Mar 2009) | 1 line
Add an entry to developers.txt.
........
r70764 | martin.v.loewis | 2009-03-30 17:06:33 -0500 (Mon, 30 Mar 2009) | 2 lines
Add several VM developers.
........
r70765 | georg.brandl | 2009-03-30 17:09:34 -0500 (Mon, 30 Mar 2009) | 1 line
#5199: make warning about vars() assignment more visible.
........
r70769 | andrew.kuchling | 2009-03-30 17:29:53 -0500 (Mon, 30 Mar 2009) | 1 line
Remove comment
........
r70770 | andrew.kuchling | 2009-03-30 17:30:20 -0500 (Mon, 30 Mar 2009) | 1 line
Add several items and placeholders
........
r70771 | andrew.kuchling | 2009-03-30 17:31:11 -0500 (Mon, 30 Mar 2009) | 1 line
Many edits
........
r70773 | georg.brandl | 2009-03-30 17:43:00 -0500 (Mon, 30 Mar 2009) | 1 line
#5039: make it clear that the impl. note refers to CPython.
........
r70776 | andrew.kuchling | 2009-03-30 18:08:24 -0500 (Mon, 30 Mar 2009) | 1 line
typo fix
........
r70777 | andrew.kuchling | 2009-03-30 18:09:46 -0500 (Mon, 30 Mar 2009) | 1 line
Add more items
........
r70788 | andrew.kuchling | 2009-03-30 20:21:01 -0500 (Mon, 30 Mar 2009) | 1 line
Add various items
........
r70789 | georg.brandl | 2009-03-30 20:25:15 -0500 (Mon, 30 Mar 2009) | 1 line
Fix a wrong struct field assignment (docstring as closure).
........
r70824 | georg.brandl | 2009-03-31 10:43:20 -0500 (Tue, 31 Mar 2009) | 1 line
#5519: remove reference to Kodos, which seems dead.
........
r70828 | georg.brandl | 2009-03-31 10:50:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5581: fget argument of abstractproperty is optional as well.
........
r70832 | georg.brandl | 2009-03-31 11:31:11 -0500 (Tue, 31 Mar 2009) | 1 line
#1386675: specify WindowsError as the exception, because it has a winerror attribute that EnvironmentError doesnt have.
........
r70836 | georg.brandl | 2009-03-31 11:50:25 -0500 (Tue, 31 Mar 2009) | 1 line
#5417: replace references to undocumented functions by ones to documented functions.
........
r70842 | georg.brandl | 2009-03-31 12:13:06 -0500 (Tue, 31 Mar 2009) | 1 line
#970783: document PyObject_Generic[GS]etAttr.
........
r70851 | georg.brandl | 2009-03-31 13:26:55 -0500 (Tue, 31 Mar 2009) | 1 line
#837577: note cryptic return value of spawn*e on invalid env dicts.
........
r70855 | georg.brandl | 2009-03-31 13:30:37 -0500 (Tue, 31 Mar 2009) | 1 line
#5245: note that PyRun_SimpleString doesnt return on SystemExit.
........
r70857 | georg.brandl | 2009-03-31 13:33:10 -0500 (Tue, 31 Mar 2009) | 1 line
#5227: note that Py_Main doesnt return on SystemExit.
........
r70866 | georg.brandl | 2009-03-31 14:06:57 -0500 (Tue, 31 Mar 2009) | 1 line
#4882: document named group behavior a bit better.
........
r70867 | georg.brandl | 2009-03-31 14:10:35 -0500 (Tue, 31 Mar 2009) | 1 line
#1096310: document usage of sys.__std*__ a bit better.
........
r70868 | georg.brandl | 2009-03-31 14:12:17 -0500 (Tue, 31 Mar 2009) | 1 line
#5190: export make_option in __all__.
........
r70869 | georg.brandl | 2009-03-31 14:14:42 -0500 (Tue, 31 Mar 2009) | 1 line
Fix-up unwanted change.
........
r70870 | georg.brandl | 2009-03-31 14:26:24 -0500 (Tue, 31 Mar 2009) | 1 line
#4411: document mro() and __mro__. (I hope I got it right.)
........
r70871 | georg.brandl | 2009-03-31 14:30:56 -0500 (Tue, 31 Mar 2009) | 1 line
#5618: fix typo.
........
r70872 | r.david.murray | 2009-03-31 14:31:17 -0500 (Tue, 31 Mar 2009) | 3 lines
Delete out-of-date and little-known README from the test
directory by consensus of devs at pycon sprint.
........
r70883 | georg.brandl | 2009-03-31 15:41:08 -0500 (Tue, 31 Mar 2009) | 1 line
#1674032: return value of flag from Event.wait(). OKed by Guido.
........
r70885 | tarek.ziade | 2009-03-31 15:48:31 -0500 (Tue, 31 Mar 2009) | 1 line
using log.warn for sys.stderr
........
r70893 | georg.brandl | 2009-03-31 15:56:32 -0500 (Tue, 31 Mar 2009) | 1 line
#1530012: move TQS section before raw strings.
........
r70894 | benjamin.peterson | 2009-03-31 16:06:30 -0500 (Tue, 31 Mar 2009) | 1 line
take the usual lock precautions around _active_limbo_lock
........
r70896 | georg.brandl | 2009-03-31 16:15:33 -0500 (Tue, 31 Mar 2009) | 1 line
#5598: document DocFileSuite *args argument.
........
r70897 | benjamin.peterson | 2009-03-31 16:34:42 -0500 (Tue, 31 Mar 2009) | 1 line
fix Thread.ident when it is the main thread or a dummy thread #5632
........
r70903 | georg.brandl | 2009-03-31 16:45:18 -0500 (Tue, 31 Mar 2009) | 1 line
#1676135: remove trailing slashes from --prefix argument.
........
r70905 | georg.brandl | 2009-03-31 17:03:40 -0500 (Tue, 31 Mar 2009) | 1 line
#5563: more documentation for bdist_msi.
........
r70906 | georg.brandl | 2009-03-31 17:11:53 -0500 (Tue, 31 Mar 2009) | 1 line
#1651995: fix _convert_ref for non-ASCII characters.
........
r70907 | georg.brandl | 2009-03-31 17:18:19 -0500 (Tue, 31 Mar 2009) | 1 line
#3427: document correct return type for urlopen().info().
........
r70915 | georg.brandl | 2009-03-31 17:40:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5018: remove confusing paragraph.
........
r70927 | georg.brandl | 2009-03-31 18:01:27 -0500 (Tue, 31 Mar 2009) | 1 line
Dont shout to users.
........
r70933 | georg.brandl | 2009-03-31 19:04:33 -0500 (Tue, 31 Mar 2009) | 2 lines
Issue #5635: Fix running test_sys with tracing enabled.
........
r70951 | georg.brandl | 2009-04-01 09:02:27 -0500 (Wed, 01 Apr 2009) | 1 line
Add Maksim, who worked on several issues at the sprint.
........
r70960 | jesse.noller | 2009-04-01 11:42:19 -0500 (Wed, 01 Apr 2009) | 1 line
Issue 3270: document Listener address restrictions on windows
........
r70962 | brett.cannon | 2009-04-01 12:07:16 -0500 (Wed, 01 Apr 2009) | 2 lines
Ron DuPlain was given commit privileges at PyCon 2009 to work on 3to2.
........
r70963 | georg.brandl | 2009-04-01 12:46:01 -0500 (Wed, 01 Apr 2009) | 1 line
#5655: fix docstring oversight.
........
r70964 | brett.cannon | 2009-04-01 12:52:13 -0500 (Wed, 01 Apr 2009) | 2 lines
Paul Kippes was given commit privileges to work on 3to2.
........
r70998 | georg.brandl | 2009-04-01 16:54:21 -0500 (Wed, 01 Apr 2009) | 1 line
In Pdb, stop assigning values to __builtin__._ which interferes with the one commonly installed by gettext.
........
r71001 | brett.cannon | 2009-04-01 18:01:12 -0500 (Wed, 01 Apr 2009) | 3 lines
Add my initials to Misc/developers.txt. Names are now sorted by number of
characters in the person's name.
........
r71006 | georg.brandl | 2009-04-01 18:32:17 -0500 (Wed, 01 Apr 2009) | 1 line
Cache the f_locals dict of the current frame, since every access to frame.f_locals overrides its contents with the real locals which undoes modifications made by the debugging user.
........
r71008 | andrew.kuchling | 2009-04-01 19:02:14 -0500 (Wed, 01 Apr 2009) | 1 line
Typo fix
........
r71010 | benjamin.peterson | 2009-04-01 19:11:52 -0500 (Wed, 01 Apr 2009) | 1 line
fix markup
........
r71011 | benjamin.peterson | 2009-04-01 19:12:47 -0500 (Wed, 01 Apr 2009) | 1 line
this should be :noindex:
........
r71019 | georg.brandl | 2009-04-01 21:00:01 -0500 (Wed, 01 Apr 2009) | 1 line
Fix test_doctest, missed two assignments to curframe.
........
r71037 | r.david.murray | 2009-04-01 23:34:04 -0500 (Wed, 01 Apr 2009) | 6 lines
Clarify that datetime strftime does not produce leap seconds and datetime
strptime does not accept it in the strftime behavior section of the
datetime docs.
Closes issue 2568.
........
r71056 | georg.brandl | 2009-04-02 12:43:07 -0500 (Thu, 02 Apr 2009) | 2 lines
Actually the displayhook should print the repr.
........
r71094 | vinay.sajip | 2009-04-03 05:23:18 -0500 (Fri, 03 Apr 2009) | 1 line
Added warning about logging use from asynchronous signal handlers.
........
r71101 | andrew.kuchling | 2009-04-03 16:43:00 -0500 (Fri, 03 Apr 2009) | 1 line
Add some items
........
r71102 | andrew.kuchling | 2009-04-03 16:44:49 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the'; grammar fix
........
r71103 | andrew.kuchling | 2009-04-03 16:45:29 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the' duplication
........
r71106 | vinay.sajip | 2009-04-03 16:58:16 -0500 (Fri, 03 Apr 2009) | 1 line
Clarified warning about logging use from asynchronous signal handlers.
........
r71119 | raymond.hettinger | 2009-04-04 00:37:47 -0500 (Sat, 04 Apr 2009) | 1 line
Add helpful link.
........
r71123 | r.david.murray | 2009-04-04 01:39:56 -0500 (Sat, 04 Apr 2009) | 2 lines
Fix error in description of 'oct' (issue 5678).
........
r71149 | georg.brandl | 2009-04-04 08:42:39 -0500 (Sat, 04 Apr 2009) | 1 line
#5642: clarify map() compatibility to the builtin.
........
r71150 | georg.brandl | 2009-04-04 08:45:49 -0500 (Sat, 04 Apr 2009) | 1 line
#5601: clarify that webbrowser is not meant for file names.
........
r71203 | benjamin.peterson | 2009-04-04 18:46:34 -0500 (Sat, 04 Apr 2009) | 1 line
note how using iter* are unsafe while mutating and document iter(dict)
........
r71212 | georg.brandl | 2009-04-05 05:24:20 -0500 (Sun, 05 Apr 2009) | 1 line
#1742837: expand HTTP server docs, and fix SocketServer ones to document methods as methods, not functions.
........
r71214 | georg.brandl | 2009-04-05 05:29:57 -0500 (Sun, 05 Apr 2009) | 1 line
Normalize spelling of Mac OS X.
........
r71215 | georg.brandl | 2009-04-05 05:32:26 -0500 (Sun, 05 Apr 2009) | 1 line
Avoid sure signs of a diseased mind.
........
r71216 | georg.brandl | 2009-04-05 05:41:02 -0500 (Sun, 05 Apr 2009) | 1 line
#1718017: document the relation of os.path and the posixpath, ntpath etc. modules better.
........
r71217 | georg.brandl | 2009-04-05 05:48:47 -0500 (Sun, 05 Apr 2009) | 1 line
#1726172: dont raise an unexpected IndexError if a voidresp() call has an empty response.
........
r71221 | vinay.sajip | 2009-04-05 06:06:24 -0500 (Sun, 05 Apr 2009) | 1 line
Issue #5695: Moved logging.captureWarnings() call inside with statement in WarningsTest.test_warnings.
........
r71240 | georg.brandl | 2009-04-05 09:40:06 -0500 (Sun, 05 Apr 2009) | 1 line
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
........
2009-04-05 16:13:16 -03:00
|
|
|
the new process to inherit the environment of the current process. Note that
|
|
|
|
keys and values in the *env* dictionary must be strings; invalid keys or
|
|
|
|
values will cause the function to fail, with a return value of ``127``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` are
|
|
|
|
equivalent::
|
|
|
|
|
|
|
|
import os
|
|
|
|
os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')
|
|
|
|
|
|
|
|
L = ['cp', 'index.html', '/dev/null']
|
|
|
|
os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)
|
|
|
|
|
2020-02-04 20:15:00 -04:00
|
|
|
.. audit-event:: os.spawn mode,path,args,env os.spawnl
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, Windows, not Emscripten, not WASI.
|
2022-07-29 11:42:09 -03:00
|
|
|
|
|
|
|
:func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp`
|
2018-10-12 11:55:20 -03:00
|
|
|
and :func:`spawnvpe` are not available on Windows. :func:`spawnle` and
|
|
|
|
:func:`spawnve` are not thread-safe on Windows; we advise you to use the
|
|
|
|
:mod:`subprocess` module instead.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 19:55:02 -03:00
|
|
|
.. versionchanged:: 3.6
|
|
|
|
Accepts a :term:`path-like object`.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. data:: P_NOWAIT
|
|
|
|
P_NOWAITO
|
|
|
|
|
2013-10-13 14:12:43 -03:00
|
|
|
Possible values for the *mode* parameter to the :func:`spawn\* <spawnl>` family of
|
2007-08-15 11:28:22 -03:00
|
|
|
functions. If either of these values is given, the :func:`spawn\*` functions
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
will return as soon as the new process has been created, with the process id as
|
2010-05-06 20:03:05 -03:00
|
|
|
the return value.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: P_WAIT
|
|
|
|
|
2013-10-13 14:12:43 -03:00
|
|
|
Possible value for the *mode* parameter to the :func:`spawn\* <spawnl>` family of
|
2007-08-15 11:28:22 -03:00
|
|
|
functions. If this is given as *mode*, the :func:`spawn\*` functions will not
|
|
|
|
return until the new process has run to completion and will return the exit code
|
|
|
|
of the process the run is successful, or ``-signal`` if a signal kills the
|
2010-05-06 20:03:05 -03:00
|
|
|
process.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: P_DETACH
|
|
|
|
P_OVERLAY
|
|
|
|
|
2013-10-13 14:12:43 -03:00
|
|
|
Possible values for the *mode* parameter to the :func:`spawn\* <spawnl>` family of
|
2007-08-15 11:28:22 -03:00
|
|
|
functions. These are less portable than those listed above. :const:`P_DETACH`
|
|
|
|
is similar to :const:`P_NOWAIT`, but the new process is detached from the
|
|
|
|
console of the calling process. If :const:`P_OVERLAY` is used, the current
|
2013-10-13 14:12:43 -03:00
|
|
|
process will be replaced; the :func:`spawn\* <spawnl>` function will not return.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2021-04-23 14:03:17 -03:00
|
|
|
.. function:: startfile(path, [operation], [arguments], [cwd], [show_cmd])
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Start a file with its associated application.
|
|
|
|
|
2022-07-29 13:24:56 -03:00
|
|
|
When *operation* is not specified, this acts like double-clicking
|
2007-08-15 11:28:22 -03:00
|
|
|
the file in Windows Explorer, or giving the file name as an argument to the
|
|
|
|
:program:`start` command from the interactive command shell: the file is opened
|
|
|
|
with whatever application (if any) its extension is associated.
|
|
|
|
|
|
|
|
When another *operation* is given, it must be a "command verb" that specifies
|
2022-07-29 13:24:56 -03:00
|
|
|
what should be done with the file. Common verbs documented by Microsoft are ``'open'``,
|
2007-08-15 11:28:22 -03:00
|
|
|
``'print'`` and ``'edit'`` (to be used on files) as well as ``'explore'`` and
|
|
|
|
``'find'`` (to be used on directories).
|
|
|
|
|
2021-04-23 14:03:17 -03:00
|
|
|
When launching an application, specify *arguments* to be passed as a single
|
|
|
|
string. This argument may have no effect when using this function to launch a
|
|
|
|
document.
|
|
|
|
|
|
|
|
The default working directory is inherited, but may be overridden by the *cwd*
|
|
|
|
argument. This should be an absolute path. A relative *path* will be resolved
|
|
|
|
against this argument.
|
|
|
|
|
|
|
|
Use *show_cmd* to override the default window style. Whether this has any
|
|
|
|
effect will depend on the application being launched. Values are integers as
|
2023-08-19 14:03:26 -03:00
|
|
|
supported by the Win32 :c:func:`!ShellExecute` function.
|
2021-04-23 14:03:17 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`startfile` returns as soon as the associated application is launched.
|
|
|
|
There is no option to wait for the application to close, and no way to retrieve
|
|
|
|
the application's exit status. The *path* parameter is relative to the current
|
2021-04-23 14:03:17 -03:00
|
|
|
directory or *cwd*. If you want to use an absolute path, make sure the first
|
|
|
|
character is not a slash (``'/'``) Use :mod:`pathlib` or the
|
|
|
|
:func:`os.path.normpath` function to ensure that paths are properly encoded for
|
|
|
|
Win32.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2023-08-19 14:03:26 -03:00
|
|
|
To reduce interpreter startup overhead, the Win32 :c:func:`!ShellExecute`
|
2015-01-24 12:18:24 -04:00
|
|
|
function is not resolved until this function is first called. If the function
|
|
|
|
cannot be resolved, :exc:`NotImplementedError` will be raised.
|
|
|
|
|
2020-02-04 20:15:00 -04:00
|
|
|
.. audit-event:: os.startfile path,operation os.startfile
|
|
|
|
|
2021-04-23 14:03:17 -03:00
|
|
|
.. audit-event:: os.startfile/2 path,operation,arguments,cwd,show_cmd os.startfile
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2021-04-23 14:03:17 -03:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
Added the *arguments*, *cwd* and *show_cmd* arguments, and the
|
|
|
|
``os.startfile/2`` audit event.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: system(command)
|
|
|
|
|
|
|
|
Execute the command (a string) in a subshell. This is implemented by calling
|
2010-10-06 07:11:56 -03:00
|
|
|
the Standard C function :c:func:`system`, and has the same limitations.
|
2010-10-14 03:35:53 -03:00
|
|
|
Changes to :data:`sys.stdin`, etc. are not reflected in the environment of
|
|
|
|
the executed command. If *command* generates any output, it will be sent to
|
2021-05-11 17:47:05 -03:00
|
|
|
the interpreter standard output stream. The C standard does not
|
|
|
|
specify the meaning of the return value of the C function, so the return
|
|
|
|
value of the Python function is system-dependent.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
On Unix, the return value is the exit status of the process encoded in the
|
2021-05-11 17:47:05 -03:00
|
|
|
format specified for :func:`wait`.
|
2010-10-14 03:35:53 -03:00
|
|
|
|
|
|
|
On Windows, the return value is that returned by the system shell after
|
|
|
|
running *command*. The shell is given by the Windows environment variable
|
|
|
|
:envvar:`COMSPEC`: it is usually :program:`cmd.exe`, which returns the exit
|
|
|
|
status of the command run; on systems using a non-native shell, consult your
|
|
|
|
shell documentation.
|
|
|
|
|
|
|
|
The :mod:`subprocess` module provides more powerful facilities for spawning
|
|
|
|
new processes and retrieving their results; using that module is preferable
|
|
|
|
to using this function. See the :ref:`subprocess-replacements` section in
|
|
|
|
the :mod:`subprocess` documentation for some helpful recipes.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-04-01 13:49:29 -03:00
|
|
|
On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result
|
|
|
|
(exit status) into an exit code. On Windows, the result is directly the exit
|
|
|
|
code.
|
|
|
|
|
2019-06-27 14:47:59 -03:00
|
|
|
.. audit-event:: os.system command os.system
|
2019-05-23 12:45:22 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, Windows, not Emscripten, not WASI.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: times()
|
|
|
|
|
2012-06-24 08:33:36 -03:00
|
|
|
Returns the current global process times.
|
|
|
|
The return value is an object with five attributes:
|
|
|
|
|
2022-01-07 14:28:08 -04:00
|
|
|
* :attr:`!user` - user time
|
|
|
|
* :attr:`!system` - system time
|
|
|
|
* :attr:`!children_user` - user time of all child processes
|
|
|
|
* :attr:`!children_system` - system time of all child processes
|
|
|
|
* :attr:`!elapsed` - elapsed real time since a fixed point in the past
|
2012-06-24 08:33:36 -03:00
|
|
|
|
|
|
|
For backwards compatibility, this object also behaves like a five-tuple
|
2022-01-07 14:28:08 -04:00
|
|
|
containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`,
|
|
|
|
:attr:`!children_system`, and :attr:`!elapsed` in that order.
|
2012-06-24 08:33:36 -03:00
|
|
|
|
|
|
|
See the Unix manual page
|
2023-05-02 03:34:44 -03:00
|
|
|
:manpage:`times(2)` and `times(3) <https://man.freebsd.org/cgi/man.cgi?time(3)>`_ manual page on Unix or `the GetProcessTimes MSDN
|
2020-02-10 18:50:19 -04:00
|
|
|
<https://docs.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes>`_
|
2022-01-07 14:28:08 -04:00
|
|
|
on Windows. On Windows, only :attr:`!user` and :attr:`!system` are known; the other attributes are zero.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix, Windows.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-06-24 08:33:36 -03:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
Return type changed from a tuple to a tuple-like object
|
|
|
|
with named attributes.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: wait()
|
|
|
|
|
|
|
|
Wait for completion of a child process, and return a tuple containing its pid
|
|
|
|
and exit status indication: a 16-bit number, whose low byte is the signal number
|
|
|
|
that killed the process, and whose high byte is the exit status (if the signal
|
|
|
|
number is zero); the high bit of the low byte is set if a core file was
|
2010-05-06 20:03:05 -03:00
|
|
|
produced.
|
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
If there are no children that could be waited for, :exc:`ChildProcessError`
|
|
|
|
is raised.
|
|
|
|
|
2020-04-01 13:49:29 -03:00
|
|
|
:func:`waitstatus_to_exitcode` can be used to convert the exit status into an
|
|
|
|
exit code.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-04-01 13:49:29 -03:00
|
|
|
.. seealso::
|
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
The other :func:`!wait*` functions documented below can be used to wait for the
|
|
|
|
completion of a specific child process and have more options.
|
|
|
|
:func:`waitpid` is the only one also available on Windows.
|
2020-04-01 13:49:29 -03:00
|
|
|
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
.. function:: waitid(idtype, id, options, /)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
Wait for the completion of a child process.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :data:`P_PIDFD`.
|
|
|
|
The interpretation of *id* depends on it; see their individual descriptions.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
*options* is an OR combination of flags. At least one of :data:`WEXITED`,
|
|
|
|
:data:`WSTOPPED` or :data:`WCONTINUED` is required;
|
|
|
|
:data:`WNOHANG` and :data:`WNOWAIT` are additional optional flags.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
The return value is an object representing the data contained in the
|
2023-07-22 15:35:22 -03:00
|
|
|
:c:type:`siginfo_t` structure with the following attributes:
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
* :attr:`!si_pid` (process ID)
|
|
|
|
* :attr:`!si_uid` (real user ID of the child)
|
2023-07-21 06:40:37 -03:00
|
|
|
* :attr:`!si_signo` (always :const:`~signal.SIGCHLD`)
|
2022-11-28 05:41:24 -04:00
|
|
|
* :attr:`!si_status` (the exit status or signal number, depending on :attr:`!si_code`)
|
|
|
|
* :attr:`!si_code` (see :data:`CLD_EXITED` for possible values)
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
If :data:`WNOHANG` is specified and there are no matching children in the
|
|
|
|
requested state, ``None`` is returned.
|
|
|
|
Otherwise, if there are no matching children
|
|
|
|
that could be waited for, :exc:`ChildProcessError` is raised.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2011-03-17 15:20:30 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: waitpid(pid, options, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
The details of this function differ on Unix and Windows.
|
|
|
|
|
|
|
|
On Unix: Wait for completion of a child process given by process id *pid*, and
|
|
|
|
return a tuple containing its process id and exit status indication (encoded as
|
|
|
|
for :func:`wait`). The semantics of the call are affected by the value of the
|
|
|
|
integer *options*, which should be ``0`` for normal operation.
|
|
|
|
|
|
|
|
If *pid* is greater than ``0``, :func:`waitpid` requests status information for
|
|
|
|
that specific process. If *pid* is ``0``, the request is for the status of any
|
|
|
|
child in the process group of the current process. If *pid* is ``-1``, the
|
|
|
|
request pertains to any child of the current process. If *pid* is less than
|
|
|
|
``-1``, status is requested for any process in the process group ``-pid`` (the
|
|
|
|
absolute value of *pid*).
|
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
*options* is an OR combination of flags. If it contains :data:`WNOHANG` and
|
|
|
|
there are no matching children in the requested state, ``(0, 0)`` is
|
|
|
|
returned. Otherwise, if there are no matching children that could be waited
|
|
|
|
for, :exc:`ChildProcessError` is raised. Other options that can be used are
|
|
|
|
:data:`WUNTRACED` and :data:`WCONTINUED`.
|
Merged revisions 65659,65693,65700,65702,65706-65707,65761 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65659 | martin.v.loewis | 2008-08-12 15:45:21 -0500 (Tue, 12 Aug 2008) | 2 lines
Add Hirokazu Yamamoto.
........
r65693 | georg.brandl | 2008-08-15 13:35:09 -0500 (Fri, 15 Aug 2008) | 2 lines
#3558: Attribute reference binds more tightly than subscription and call.
........
r65700 | antoine.pitrou | 2008-08-15 16:03:21 -0500 (Fri, 15 Aug 2008) | 3 lines
#2676: email/message.py [Message.get_content_type]: Trivial regex hangs on pathological input
........
r65702 | gregory.p.smith | 2008-08-15 18:14:00 -0500 (Fri, 15 Aug 2008) | 2 lines
document that waitpid raises OSError
........
r65706 | benjamin.peterson | 2008-08-15 22:02:41 -0500 (Fri, 15 Aug 2008) | 1 line
fix markup
........
r65707 | benjamin.peterson | 2008-08-15 22:13:07 -0500 (Fri, 15 Aug 2008) | 1 line
note how os.utime should be used for emulating touch
........
r65761 | antoine.pitrou | 2008-08-17 08:06:29 -0500 (Sun, 17 Aug 2008) | 3 lines
fix ZipFile.testzip() to work with very large embedded files
........
2008-08-17 17:23:46 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
On Windows: Wait for completion of a process given by process handle *pid*, and
|
|
|
|
return a tuple containing *pid*, and its exit status shifted left by 8 bits
|
|
|
|
(shifting makes cross-platform use of the function easier). A *pid* less than or
|
|
|
|
equal to ``0`` has no special meaning on Windows, and raises an exception. The
|
|
|
|
value of integer *options* has no effect. *pid* can refer to any process whose
|
2013-10-13 14:12:43 -03:00
|
|
|
id is known, not necessarily a child process. The :func:`spawn\* <spawnl>`
|
|
|
|
functions called with :const:`P_NOWAIT` return suitable process handles.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2020-04-01 13:49:29 -03:00
|
|
|
:func:`waitstatus_to_exitcode` can be used to convert the exit status into an
|
|
|
|
exit code.
|
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
.. availability:: Unix, Windows, not Emscripten, not WASI.
|
2022-08-02 16:00:41 -03:00
|
|
|
|
2015-03-26 19:50:57 -03:00
|
|
|
.. versionchanged:: 3.5
|
2015-04-02 06:49:42 -03:00
|
|
|
If the system call is interrupted and the signal handler does not raise an
|
2015-03-26 19:50:57 -03:00
|
|
|
exception, the function now retries the system call instead of raising an
|
|
|
|
:exc:`InterruptedError` exception (see :pep:`475` for the rationale).
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-11-23 13:45:52 -04:00
|
|
|
.. function:: wait3(options)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Similar to :func:`waitpid`, except no process id argument is given and a
|
2018-10-30 21:26:06 -03:00
|
|
|
3-element tuple containing the child's process id, exit status indication,
|
|
|
|
and resource usage information is returned. Refer to
|
2022-11-28 05:41:24 -04:00
|
|
|
:func:`resource.getrusage` for details on resource usage information. The
|
|
|
|
*options* argument is the same as that provided to :func:`waitpid` and
|
|
|
|
:func:`wait4`.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-04-01 13:49:29 -03:00
|
|
|
:func:`waitstatus_to_exitcode` can be used to convert the exit status into an
|
|
|
|
exitcode.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2012-02-08 18:03:19 -04:00
|
|
|
.. function:: wait4(pid, options)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Similar to :func:`waitpid`, except a 3-element tuple, containing the child's
|
2022-11-28 05:41:24 -04:00
|
|
|
process id, exit status indication, and resource usage information is
|
|
|
|
returned. Refer to :func:`resource.getrusage` for details on resource usage
|
|
|
|
information. The arguments to :func:`wait4` are the same as those provided
|
|
|
|
to :func:`waitpid`.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-04-01 13:49:29 -03:00
|
|
|
:func:`waitstatus_to_exitcode` can be used to convert the exit status into an
|
|
|
|
exitcode.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2022-11-28 05:41:24 -04:00
|
|
|
.. data:: P_PID
|
|
|
|
P_PGID
|
|
|
|
P_ALL
|
|
|
|
P_PIDFD
|
|
|
|
|
|
|
|
These are the possible values for *idtype* in :func:`waitid`. They affect
|
|
|
|
how *id* is interpreted:
|
|
|
|
|
|
|
|
* :data:`!P_PID` - wait for the child whose PID is *id*.
|
|
|
|
* :data:`!P_PGID` - wait for any child whose progress group ID is *id*.
|
|
|
|
* :data:`!P_ALL` - wait for any child; *id* is ignored.
|
|
|
|
* :data:`!P_PIDFD` - wait for the child identified by the file descriptor
|
|
|
|
*id* (a process file descriptor created with :func:`pidfd_open`).
|
|
|
|
|
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
|
|
|
|
|
|
|
.. note:: :data:`!P_PIDFD` is only available on Linux >= 5.4.
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
.. versionadded:: 3.9
|
|
|
|
The :data:`!P_PIDFD` constant.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: WCONTINUED
|
|
|
|
|
|
|
|
This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and
|
|
|
|
:func:`waitid` causes child processes to be reported if they have been
|
|
|
|
continued from a job control stop since they were last reported.
|
|
|
|
|
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: WEXITED
|
|
|
|
|
|
|
|
This *options* flag for :func:`waitid` causes child processes that have terminated to
|
|
|
|
be reported.
|
|
|
|
|
|
|
|
The other ``wait*`` functions always report children that have terminated,
|
|
|
|
so this option is not available for them.
|
|
|
|
|
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: WSTOPPED
|
|
|
|
|
|
|
|
This *options* flag for :func:`waitid` causes child processes that have been stopped
|
|
|
|
by the delivery of a signal to be reported.
|
|
|
|
|
|
|
|
This option is not available for the other ``wait*`` functions.
|
|
|
|
|
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: WUNTRACED
|
|
|
|
|
|
|
|
This *options* flag for :func:`waitpid`, :func:`wait3`, and :func:`wait4` causes
|
|
|
|
child processes to also be reported if they have been stopped but their
|
|
|
|
current state has not been reported since they were stopped.
|
|
|
|
|
|
|
|
This option is not available for :func:`waitid`.
|
|
|
|
|
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: WNOHANG
|
|
|
|
|
|
|
|
This *options* flag causes :func:`waitpid`, :func:`wait3`, :func:`wait4`, and
|
|
|
|
:func:`waitid` to return right away if no child process status is available
|
|
|
|
immediately.
|
|
|
|
|
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: WNOWAIT
|
|
|
|
|
|
|
|
This *options* flag causes :func:`waitid` to leave the child in a waitable state, so that
|
|
|
|
a later :func:`!wait*` call can be used to retrieve the child status information again.
|
|
|
|
|
|
|
|
This option is not available for the other ``wait*`` functions.
|
|
|
|
|
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: CLD_EXITED
|
|
|
|
CLD_KILLED
|
|
|
|
CLD_DUMPED
|
|
|
|
CLD_TRAPPED
|
|
|
|
CLD_STOPPED
|
|
|
|
CLD_CONTINUED
|
|
|
|
|
|
|
|
These are the possible values for :attr:`!si_code` in the result returned by
|
|
|
|
:func:`waitid`.
|
|
|
|
|
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
.. versionchanged:: 3.9
|
|
|
|
Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values.
|
|
|
|
|
|
|
|
|
2020-04-01 13:49:29 -03:00
|
|
|
.. function:: waitstatus_to_exitcode(status)
|
|
|
|
|
|
|
|
Convert a wait status to an exit code.
|
|
|
|
|
|
|
|
On Unix:
|
|
|
|
|
|
|
|
* If the process exited normally (if ``WIFEXITED(status)`` is true),
|
|
|
|
return the process exit status (return ``WEXITSTATUS(status)``):
|
|
|
|
result greater than or equal to 0.
|
|
|
|
* If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is
|
|
|
|
true), return ``-signum`` where *signum* is the number of the signal that
|
|
|
|
caused the process to terminate (return ``-WTERMSIG(status)``):
|
|
|
|
result less than 0.
|
|
|
|
* Otherwise, raise a :exc:`ValueError`.
|
|
|
|
|
|
|
|
On Windows, return *status* shifted right by 8 bits.
|
|
|
|
|
|
|
|
On Unix, if the process is being traced or if :func:`waitpid` was called
|
|
|
|
with :data:`WUNTRACED` option, the caller must first check if
|
|
|
|
``WIFSTOPPED(status)`` is true. This function must not be called if
|
|
|
|
``WIFSTOPPED(status)`` is true.
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
:func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`,
|
|
|
|
:func:`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, Windows, not Emscripten, not WASI.
|
|
|
|
|
2020-04-01 13:49:29 -03:00
|
|
|
.. versionadded:: 3.9
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
The following functions take a process status code as returned by
|
|
|
|
:func:`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be
|
|
|
|
used to determine the disposition of a process.
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: WCOREDUMP(status, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
Return ``True`` if a core dump was generated for the process, otherwise
|
2010-05-06 20:03:05 -03:00
|
|
|
return ``False``.
|
|
|
|
|
2020-04-01 10:48:05 -03:00
|
|
|
This function should be employed only if :func:`WIFSIGNALED` is true.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: WIFCONTINUED(status)
|
|
|
|
|
2020-04-01 10:48:05 -03:00
|
|
|
Return ``True`` if a stopped child has been resumed by delivery of
|
2023-07-21 06:40:37 -03:00
|
|
|
:const:`~signal.SIGCONT` (if the process has been continued from a job
|
2020-04-01 10:48:05 -03:00
|
|
|
control stop), otherwise return ``False``.
|
|
|
|
|
|
|
|
See :data:`WCONTINUED` option.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: WIFSTOPPED(status)
|
|
|
|
|
2020-04-01 10:48:05 -03:00
|
|
|
Return ``True`` if the process was stopped by delivery of a signal,
|
|
|
|
otherwise return ``False``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2020-04-01 10:48:05 -03:00
|
|
|
:func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was
|
|
|
|
done using :data:`WUNTRACED` option or when the process is being traced (see
|
|
|
|
:manpage:`ptrace(2)`).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: WIFSIGNALED(status)
|
|
|
|
|
2020-04-01 10:48:05 -03:00
|
|
|
Return ``True`` if the process was terminated by a signal, otherwise return
|
2010-05-06 20:03:05 -03:00
|
|
|
``False``.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: WIFEXITED(status)
|
|
|
|
|
2020-04-01 10:48:05 -03:00
|
|
|
Return ``True`` if the process exited terminated normally, that is,
|
|
|
|
by calling ``exit()`` or ``_exit()``, or by returning from ``main()``;
|
2010-05-06 20:03:05 -03:00
|
|
|
otherwise return ``False``.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: WEXITSTATUS(status)
|
|
|
|
|
2020-04-01 10:48:05 -03:00
|
|
|
Return the process exit status.
|
|
|
|
|
|
|
|
This function should be employed only if :func:`WIFEXITED` is true.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: WSTOPSIG(status)
|
|
|
|
|
2010-05-06 20:03:05 -03:00
|
|
|
Return the signal which caused the process to stop.
|
|
|
|
|
2020-04-01 10:48:05 -03:00
|
|
|
This function should be employed only if :func:`WIFSTOPPED` is true.
|
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: WTERMSIG(status)
|
|
|
|
|
2020-04-01 10:48:05 -03:00
|
|
|
Return the number of the signal that caused the process to terminate.
|
|
|
|
|
|
|
|
This function should be employed only if :func:`WIFSIGNALED` is true.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2022-08-02 16:00:41 -03:00
|
|
|
.. availability:: Unix, not Emscripten, not WASI.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2011-08-02 19:30:04 -03:00
|
|
|
Interface to the scheduler
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
These functions control how a process is allocated CPU time by the operating
|
|
|
|
system. They are only available on some Unix platforms. For more detailed
|
|
|
|
information, consult your Unix manpages.
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
2013-06-21 12:49:57 -03:00
|
|
|
The following scheduling policies are exposed if they are supported by the
|
2011-08-02 19:30:04 -03:00
|
|
|
operating system.
|
|
|
|
|
|
|
|
.. data:: SCHED_OTHER
|
|
|
|
|
|
|
|
The default scheduling policy.
|
|
|
|
|
|
|
|
.. data:: SCHED_BATCH
|
|
|
|
|
|
|
|
Scheduling policy for CPU-intensive processes that tries to preserve
|
|
|
|
interactivity on the rest of the computer.
|
|
|
|
|
|
|
|
.. data:: SCHED_IDLE
|
|
|
|
|
|
|
|
Scheduling policy for extremely low priority background tasks.
|
|
|
|
|
|
|
|
.. data:: SCHED_SPORADIC
|
|
|
|
|
|
|
|
Scheduling policy for sporadic server programs.
|
|
|
|
|
|
|
|
.. data:: SCHED_FIFO
|
|
|
|
|
|
|
|
A First In First Out scheduling policy.
|
|
|
|
|
|
|
|
.. data:: SCHED_RR
|
|
|
|
|
|
|
|
A round-robin scheduling policy.
|
|
|
|
|
|
|
|
.. data:: SCHED_RESET_ON_FORK
|
|
|
|
|
2016-05-29 01:13:35 -03:00
|
|
|
This flag can be OR'ed with any other scheduling policy. When a process with
|
2011-08-02 19:30:04 -03:00
|
|
|
this flag set forks, its child's scheduling policy and priority are reset to
|
|
|
|
the default.
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: sched_param(sched_priority)
|
|
|
|
|
|
|
|
This class represents tunable scheduling parameters used in
|
|
|
|
:func:`sched_setparam`, :func:`sched_setscheduler`, and
|
|
|
|
:func:`sched_getparam`. It is immutable.
|
|
|
|
|
|
|
|
At the moment, there is only one possible parameter:
|
|
|
|
|
|
|
|
.. attribute:: sched_priority
|
|
|
|
|
|
|
|
The scheduling priority for a scheduling policy.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: sched_get_priority_min(policy)
|
|
|
|
|
|
|
|
Get the minimum priority value for *policy*. *policy* is one of the
|
|
|
|
scheduling policy constants above.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: sched_get_priority_max(policy)
|
|
|
|
|
|
|
|
Get the maximum priority value for *policy*. *policy* is one of the
|
|
|
|
scheduling policy constants above.
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: sched_setscheduler(pid, policy, param, /)
|
2011-08-02 19:30:04 -03:00
|
|
|
|
|
|
|
Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means
|
|
|
|
the calling process. *policy* is one of the scheduling policy constants
|
|
|
|
above. *param* is a :class:`sched_param` instance.
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: sched_getscheduler(pid, /)
|
2011-08-02 19:30:04 -03:00
|
|
|
|
|
|
|
Return the scheduling policy for the process with PID *pid*. A *pid* of 0
|
|
|
|
means the calling process. The result is one of the scheduling policy
|
|
|
|
constants above.
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: sched_setparam(pid, param, /)
|
2011-08-02 19:30:04 -03:00
|
|
|
|
2021-05-16 20:38:11 -03:00
|
|
|
Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 means
|
2011-08-02 19:30:04 -03:00
|
|
|
the calling process. *param* is a :class:`sched_param` instance.
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: sched_getparam(pid, /)
|
2011-08-02 19:30:04 -03:00
|
|
|
|
|
|
|
Return the scheduling parameters as a :class:`sched_param` instance for the
|
|
|
|
process with PID *pid*. A *pid* of 0 means the calling process.
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: sched_rr_get_interval(pid, /)
|
2011-08-02 19:30:04 -03:00
|
|
|
|
|
|
|
Return the round-robin quantum in seconds for the process with PID *pid*. A
|
|
|
|
*pid* of 0 means the calling process.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: sched_yield()
|
|
|
|
|
|
|
|
Voluntarily relinquish the CPU.
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: sched_setaffinity(pid, mask, /)
|
2011-08-02 19:30:04 -03:00
|
|
|
|
2012-08-04 11:16:35 -03:00
|
|
|
Restrict the process with PID *pid* (or the current process if zero) to a
|
|
|
|
set of CPUs. *mask* is an iterable of integers representing the set of
|
|
|
|
CPUs to which the process should be restricted.
|
2011-08-02 19:30:04 -03:00
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: sched_getaffinity(pid, /)
|
2011-08-02 19:30:04 -03:00
|
|
|
|
2023-09-30 19:12:51 -03:00
|
|
|
Return the set of CPUs the process with PID *pid* is restricted to.
|
|
|
|
|
|
|
|
If *pid* is zero, return the set of CPUs the calling thread of the current
|
|
|
|
process is restricted to.
|
|
|
|
|
|
|
|
See also the :func:`process_cpu_count` function.
|
2011-08-02 19:30:04 -03:00
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. _os-path:
|
|
|
|
|
|
|
|
Miscellaneous System Information
|
|
|
|
--------------------------------
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: confstr(name, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return string-valued system configuration values. *name* specifies the
|
|
|
|
configuration value to retrieve; it may be a string which is the name of a
|
|
|
|
defined system value; these names are specified in a number of standards (POSIX,
|
|
|
|
Unix 95, Unix 98, and others). Some platforms define additional names as well.
|
|
|
|
The names known to the host operating system are given as the keys of the
|
|
|
|
``confstr_names`` dictionary. For configuration variables not included in that
|
2010-05-06 20:03:05 -03:00
|
|
|
mapping, passing an integer for *name* is also accepted.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
If the configuration value specified by *name* isn't defined, ``None`` is
|
|
|
|
returned.
|
|
|
|
|
|
|
|
If *name* is a string and is not known, :exc:`ValueError` is raised. If a
|
|
|
|
specific value for *name* is not supported by the host system, even if it is
|
|
|
|
included in ``confstr_names``, an :exc:`OSError` is raised with
|
|
|
|
:const:`errno.EINVAL` for the error number.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. data:: confstr_names
|
|
|
|
|
|
|
|
Dictionary mapping names accepted by :func:`confstr` to the integer values
|
|
|
|
defined for those names by the host operating system. This can be used to
|
2010-05-06 20:03:05 -03:00
|
|
|
determine the set of names known to the system.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2013-05-20 09:40:46 -03:00
|
|
|
.. function:: cpu_count()
|
|
|
|
|
2023-09-30 19:12:51 -03:00
|
|
|
Return the number of logical CPUs in the **system**. Returns ``None`` if
|
|
|
|
undetermined.
|
2015-07-13 17:01:39 -03:00
|
|
|
|
2023-09-30 19:12:51 -03:00
|
|
|
The :func:`process_cpu_count` function can be used to get the number of
|
|
|
|
logical CPUs usable by the calling thread of the **current process**.
|
2015-07-13 17:01:39 -03:00
|
|
|
|
2013-05-20 09:40:46 -03:00
|
|
|
.. versionadded:: 3.4
|
|
|
|
|
2023-10-10 07:00:09 -03:00
|
|
|
.. versionchanged:: 3.13
|
|
|
|
If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is set,
|
|
|
|
:func:`cpu_count` returns the overridden value *n*.
|
|
|
|
|
2013-05-20 09:40:46 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: getloadavg()
|
|
|
|
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 15:39:10 -04:00
|
|
|
Return the number of processes in the system run queue averaged over the last
|
|
|
|
1, 5, and 15 minutes or raises :exc:`OSError` if the load average was
|
2010-05-06 20:03:05 -03:00
|
|
|
unobtainable.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2023-09-30 19:12:51 -03:00
|
|
|
.. function:: process_cpu_count()
|
|
|
|
|
|
|
|
Get the number of logical CPUs usable by the calling thread of the **current
|
|
|
|
process**. Returns ``None`` if undetermined. It can be less than
|
|
|
|
:func:`cpu_count` depending on the CPU affinity.
|
|
|
|
|
|
|
|
The :func:`cpu_count` function can be used to get the number of logical CPUs
|
|
|
|
in the **system**.
|
|
|
|
|
2023-10-10 07:00:09 -03:00
|
|
|
If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is set,
|
|
|
|
:func:`process_cpu_count` returns the overridden value *n*.
|
|
|
|
|
2023-09-30 19:12:51 -03:00
|
|
|
See also the :func:`sched_getaffinity` functions.
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: sysconf(name, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return integer-valued system configuration values. If the configuration value
|
|
|
|
specified by *name* isn't defined, ``-1`` is returned. The comments regarding
|
|
|
|
the *name* parameter for :func:`confstr` apply here as well; the dictionary that
|
|
|
|
provides information on the known names is given by ``sysconf_names``.
|
2010-05-06 20:03:05 -03:00
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: sysconf_names
|
|
|
|
|
|
|
|
Dictionary mapping names accepted by :func:`sysconf` to the integer values
|
|
|
|
defined for those names by the host operating system. This can be used to
|
2010-05-06 20:03:05 -03:00
|
|
|
determine the set of names known to the system.
|
|
|
|
|
2018-10-12 11:55:20 -03:00
|
|
|
.. availability:: Unix.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-03-11 18:01:40 -04:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
Add ``'SC_MINSIGSTKSZ'`` name.
|
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
The following data values are used to support path manipulation operations. These
|
2007-08-15 11:28:22 -03:00
|
|
|
are defined for all platforms.
|
|
|
|
|
|
|
|
Higher-level operations on pathnames are defined in the :mod:`os.path` module.
|
|
|
|
|
|
|
|
|
2018-10-28 08:41:26 -03:00
|
|
|
.. index:: single: . (dot); in pathnames
|
2007-08-15 11:28:22 -03:00
|
|
|
.. data:: curdir
|
|
|
|
|
|
|
|
The constant string used by the operating system to refer to the current
|
2008-09-13 14:46:05 -03:00
|
|
|
directory. This is ``'.'`` for Windows and POSIX. Also available via
|
|
|
|
:mod:`os.path`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2018-10-26 03:00:49 -03:00
|
|
|
.. index:: single: ..; in pathnames
|
2007-08-15 11:28:22 -03:00
|
|
|
.. data:: pardir
|
|
|
|
|
|
|
|
The constant string used by the operating system to refer to the parent
|
2008-09-13 14:46:05 -03:00
|
|
|
directory. This is ``'..'`` for Windows and POSIX. Also available via
|
|
|
|
:mod:`os.path`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2018-10-28 08:41:26 -03:00
|
|
|
.. index:: single: / (slash); in pathnames
|
|
|
|
.. index:: single: \ (backslash); in pathnames (Windows)
|
2007-08-15 11:28:22 -03:00
|
|
|
.. data:: sep
|
|
|
|
|
2008-09-13 14:46:05 -03:00
|
|
|
The character used by the operating system to separate pathname components.
|
|
|
|
This is ``'/'`` for POSIX and ``'\\'`` for Windows. Note that knowing this
|
|
|
|
is not sufficient to be able to parse or concatenate pathnames --- use
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`os.path.split` and :func:`os.path.join` --- but it is occasionally
|
|
|
|
useful. Also available via :mod:`os.path`.
|
|
|
|
|
|
|
|
|
2018-10-28 08:41:26 -03:00
|
|
|
.. index:: single: / (slash); in pathnames
|
2007-08-15 11:28:22 -03:00
|
|
|
.. data:: altsep
|
|
|
|
|
|
|
|
An alternative character used by the operating system to separate pathname
|
|
|
|
components, or ``None`` if only one separator character exists. This is set to
|
|
|
|
``'/'`` on Windows systems where ``sep`` is a backslash. Also available via
|
|
|
|
:mod:`os.path`.
|
|
|
|
|
|
|
|
|
2018-10-28 08:41:26 -03:00
|
|
|
.. index:: single: . (dot); in pathnames
|
2007-08-15 11:28:22 -03:00
|
|
|
.. data:: extsep
|
|
|
|
|
|
|
|
The character which separates the base filename from the extension; for example,
|
|
|
|
the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`.
|
|
|
|
|
|
|
|
|
2018-10-28 08:41:26 -03:00
|
|
|
.. index:: single: : (colon); path separator (POSIX)
|
|
|
|
single: ; (semicolon)
|
2007-08-15 11:28:22 -03:00
|
|
|
.. data:: pathsep
|
|
|
|
|
|
|
|
The character conventionally used by the operating system to separate search
|
|
|
|
path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` for
|
|
|
|
Windows. Also available via :mod:`os.path`.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: defpath
|
|
|
|
|
2013-10-13 14:12:43 -03:00
|
|
|
The default search path used by :func:`exec\*p\* <execl>` and
|
|
|
|
:func:`spawn\*p\* <spawnl>` if the environment doesn't have a ``'PATH'``
|
|
|
|
key. Also available via :mod:`os.path`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: linesep
|
|
|
|
|
|
|
|
The string used to separate (or, rather, terminate) lines on the current
|
2008-09-13 14:46:05 -03:00
|
|
|
platform. This may be a single character, such as ``'\n'`` for POSIX, or
|
|
|
|
multiple characters, for example, ``'\r\n'`` for Windows. Do not use
|
|
|
|
*os.linesep* as a line terminator when writing files opened in text mode (the
|
|
|
|
default); use a single ``'\n'`` instead, on all platforms.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. data:: devnull
|
|
|
|
|
2010-05-21 19:04:32 -03:00
|
|
|
The file path of the null device. For example: ``'/dev/null'`` for
|
|
|
|
POSIX, ``'nul'`` for Windows. Also available via :mod:`os.path`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-06-21 12:49:57 -03:00
|
|
|
.. data:: RTLD_LAZY
|
|
|
|
RTLD_NOW
|
|
|
|
RTLD_GLOBAL
|
|
|
|
RTLD_LOCAL
|
|
|
|
RTLD_NODELETE
|
|
|
|
RTLD_NOLOAD
|
|
|
|
RTLD_DEEPBIND
|
|
|
|
|
|
|
|
Flags for use with the :func:`~sys.setdlopenflags` and
|
|
|
|
:func:`~sys.getdlopenflags` functions. See the Unix manual page
|
|
|
|
:manpage:`dlopen(3)` for what the different flags mean.
|
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2016-09-06 20:18:52 -03:00
|
|
|
Random numbers
|
|
|
|
--------------
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getrandom(size, flags=0)
|
|
|
|
|
|
|
|
Get up to *size* random bytes. The function can return less bytes than
|
|
|
|
requested.
|
|
|
|
|
|
|
|
These bytes can be used to seed user-space random number generators or for
|
|
|
|
cryptographic purposes.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-09-06 20:18:52 -03:00
|
|
|
``getrandom()`` relies on entropy gathered from device drivers and other
|
|
|
|
sources of environmental noise. Unnecessarily reading large quantities of
|
|
|
|
data will have a negative impact on other users of the ``/dev/random`` and
|
|
|
|
``/dev/urandom`` devices.
|
|
|
|
|
|
|
|
The flags argument is a bit mask that can contain zero or more of the
|
2023-07-21 06:40:37 -03:00
|
|
|
following values ORed together: :py:const:`os.GRND_RANDOM` and
|
2016-09-06 20:18:52 -03:00
|
|
|
:py:data:`GRND_NONBLOCK`.
|
|
|
|
|
|
|
|
See also the `Linux getrandom() manual page
|
2022-08-04 04:13:49 -03:00
|
|
|
<https://man7.org/linux/man-pages/man2/getrandom.2.html>`_.
|
2016-09-06 20:18:52 -03:00
|
|
|
|
2022-07-29 11:42:09 -03:00
|
|
|
.. availability:: Linux >= 3.17.
|
2016-09-06 20:18:52 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-09-28 22:06:50 -03:00
|
|
|
.. function:: urandom(size, /)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2022-01-19 17:22:15 -04:00
|
|
|
Return a bytestring of *size* random bytes suitable for cryptographic use.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
This function returns random bytes from an OS-specific randomness source. The
|
|
|
|
returned data should be unpredictable enough for cryptographic applications,
|
2016-06-07 06:21:42 -03:00
|
|
|
though its exact quality depends on the OS implementation.
|
|
|
|
|
2016-09-06 20:33:52 -03:00
|
|
|
On Linux, if the ``getrandom()`` syscall is available, it is used in
|
|
|
|
blocking mode: block until the system urandom entropy pool is initialized
|
|
|
|
(128 bits of entropy are collected by the kernel). See the :pep:`524` for
|
|
|
|
the rationale. On Linux, the :func:`getrandom` function can be used to get
|
|
|
|
random bytes in non-blocking mode (using the :data:`GRND_NONBLOCK` flag) or
|
|
|
|
to poll until the system urandom entropy pool is initialized.
|
|
|
|
|
|
|
|
On a Unix-like system, random bytes are read from the ``/dev/urandom``
|
|
|
|
device. If the ``/dev/urandom`` device is not available or not readable, the
|
|
|
|
:exc:`NotImplementedError` exception is raised.
|
|
|
|
|
2021-07-24 06:14:08 -03:00
|
|
|
On Windows, it will use ``BCryptGenRandom()``.
|
2016-09-06 20:33:52 -03:00
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
The :mod:`secrets` module provides higher level functions. For an
|
|
|
|
easy-to-use interface to the random number generator provided by your
|
|
|
|
platform, please see :class:`random.SystemRandom`.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.6.0
|
|
|
|
On Linux, ``getrandom()`` is now used in blocking mode to increase the
|
|
|
|
security.
|
2015-07-28 21:28:32 -03:00
|
|
|
|
2016-06-07 06:21:42 -03:00
|
|
|
.. versionchanged:: 3.5.2
|
2016-09-06 20:18:52 -03:00
|
|
|
On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool
|
|
|
|
is not initialized yet), fall back on reading ``/dev/urandom``.
|
2016-06-07 06:21:42 -03:00
|
|
|
|
2015-07-28 21:28:32 -03:00
|
|
|
.. versionchanged:: 3.5
|
|
|
|
On Linux 3.17 and newer, the ``getrandom()`` syscall is now used
|
|
|
|
when available. On OpenBSD 5.6 and newer, the C ``getentropy()``
|
|
|
|
function is now used. These functions avoid the usage of an internal file
|
|
|
|
descriptor.
|
2016-09-06 20:18:52 -03:00
|
|
|
|
2021-07-24 06:14:08 -03:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()``
|
|
|
|
which is deprecated.
|
|
|
|
|
2016-09-06 20:18:52 -03:00
|
|
|
.. data:: GRND_NONBLOCK
|
|
|
|
|
|
|
|
By default, when reading from ``/dev/random``, :func:`getrandom` blocks if
|
|
|
|
no random bytes are available, and when reading from ``/dev/urandom``, it blocks
|
|
|
|
if the entropy pool has not yet been initialized.
|
|
|
|
|
|
|
|
If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not
|
|
|
|
block in these cases, but instead immediately raises :exc:`BlockingIOError`.
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
|
|
|
|
.. data:: GRND_RANDOM
|
|
|
|
|
|
|
|
If this bit is set, then random bytes are drawn from the
|
|
|
|
``/dev/random`` pool instead of the ``/dev/urandom`` pool.
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|