summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-20 15:14:11 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-20 15:14:11 (GMT)
commit9bd667ad030913ead3a789f45e73c26f9f28fb46 (patch)
treeea9c145cdcc74d4f1b0b084b083f9286a878c513 /Doc
parent78b11870a4c441e42cf60dca3a6d22f5896311ba (diff)
downloadcpython-9bd667ad030913ead3a789f45e73c26f9f28fb46.zip
cpython-9bd667ad030913ead3a789f45e73c26f9f28fb46.tar.gz
cpython-9bd667ad030913ead3a789f45e73c26f9f28fb46.tar.bz2
Merged revisions 60124-60142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines #1351692: in pprint, always call format() for dict and list items to enable custom formatting of contents via subclassing PrettyPrinter. ........ r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines #1178141: add addinfourl.code to get http status code from urllib. ........ r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines #856047: respect the ``no_proxy`` env var when checking for proxies in urllib and using the other ``_proxy`` env vars. Original patch by Donovan Baarda. ........ r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines #1664522: in urllib, don't read non-existing directories in ftp mode, returning a 0-byte file -- raise an IOError instead. Original patch from Phil Knirsch. ........ r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines #799369: document possible sys.platform values. ........ r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines #652749: document the constants added to the builtins by site.py. ........ r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines #1648: add sys.gettrace() and sys.getprofile(). ........ r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines #1669: don't allow shutil.rmtree() to be called on a symlink. ........ r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines Fix test_pyclbr after urllib change. ........ r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :) ........ r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines #1876: fix typos in test_operator. ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/constants.rst26
-rw-r--r--Doc/library/functions.rst2
-rw-r--r--Doc/library/shutil.rst30
-rw-r--r--Doc/library/sys.rst52
-rw-r--r--Doc/library/urllib.rst19
5 files changed, 108 insertions, 21 deletions
diff --git a/Doc/library/constants.rst b/Doc/library/constants.rst
index 3870874..12b56f8 100644
--- a/Doc/library/constants.rst
+++ b/Doc/library/constants.rst
@@ -1,4 +1,3 @@
-
Built-in Constants
==================
@@ -52,3 +51,28 @@ A small number of constants live in the built-in namespace. They are:
This constant is true if Python was not started with an :option:`-O` option.
Assignments to :const:`__debug__` are illegal and raise a :exc:`SyntaxError`.
See also the :keyword:`assert` statement.
+
+
+Constants added by the :mod:`site` module
+-----------------------------------------
+
+The :mod:`site` module (which is imported automatically during startup, except
+if the :option:`-S` command-line option is given) adds several constants to the
+built-in namespace. They are useful for the interactive interpreter shell and
+should not be used in programs.
+
+.. data:: quit([code=None])
+ exit([code=None])
+
+ Objects that when printed, print a message like "Use quit() or Ctrl-D
+ (i.e. EOF) to exit", and when called, raise :exc:`SystemExit` with the
+ specified exit code, and when .
+
+.. data:: copyright
+ license
+ credits
+
+ Objects that when printed, print a message like "Type license() to see the
+ full license text", and when called, display the corresponding text in a
+ pager-like fashion (one screen at a time).
+
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 731afb4..08ab140 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -526,6 +526,8 @@ available. They are listed here in alphabetical order.
topic, and a help page is printed on the console. If the argument is any other
kind of object, a help page on the object is generated.
+ This function is added to the built-in namespace by the :mod:`site` module.
+
.. function:: hex(x)
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
index f80c893..db4a259 100644
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -93,18 +93,24 @@ copying and removal. For operations on individual files, see also the
.. index:: single: directory; deleting
- Delete an entire directory tree (*path* must point to a directory). If
- *ignore_errors* is true, errors resulting from failed removals will be ignored;
- if false or omitted, such errors are handled by calling a handler specified by
- *onerror* or, if that is omitted, they raise an exception.
-
- If *onerror* is provided, it must be a callable that accepts three parameters:
- *function*, *path*, and *excinfo*. The first parameter, *function*, is the
- function which raised the exception; it will be :func:`os.listdir`,
- :func:`os.remove` or :func:`os.rmdir`. The second parameter, *path*, will be
- the path name passed to *function*. The third parameter, *excinfo*, will be the
- exception information return by :func:`sys.exc_info`. Exceptions raised by
- *onerror* will not be caught.
+ Delete an entire directory tree; *path* must point to a directory (but not a
+ symbolic link to a directory). If *ignore_errors* is true, errors resulting
+ from failed removals will be ignored; if false or omitted, such errors are
+ handled by calling a handler specified by *onerror* or, if that is omitted,
+ they raise an exception.
+
+ If *onerror* is provided, it must be a callable that accepts three
+ parameters: *function*, *path*, and *excinfo*. The first parameter,
+ *function*, is the function which raised the exception; it will be
+ :func:`os.path.islink`, :func:`os.listdir`, :func:`os.remove` or
+ :func:`os.rmdir`. The second parameter, *path*, will be the path name passed
+ to *function*. The third parameter, *excinfo*, will be the exception
+ information return by :func:`sys.exc_info`. Exceptions raised by *onerror*
+ will not be caught.
+
+ .. versionchanged:: 2.6
+ Explicitly check for *path* being a symbolic link and raise :exc:`OSError`
+ in that case.
.. function:: move(src, dst)
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 6d1a09b..5718f7b 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -326,6 +326,35 @@ always available.
This function should be used for internal and specialized purposes only.
+.. function:: getprofile()
+
+ .. index::
+ single: profile function
+ single: profiler
+
+ Get the profiler function as set by :func:`setprofile`.
+
+ .. versionadded:: 2.6
+
+
+.. function:: gettrace()
+
+ .. index::
+ single: trace function
+ single: debugger
+
+ Get the trace function as set by :func:`settrace`.
+
+ .. note::
+
+ The :func:`gettrace` function is intended only for implementing debuggers,
+ profilers, coverage tools and the like. Its behavior is part of the
+ implementation platform, rather than part of the language definition,
+ and thus may not be available in all Python implementations.
+
+ .. versionadded:: 2.6
+
+
.. function:: getwindowsversion()
Return a tuple containing five components, describing the Windows version
@@ -444,9 +473,26 @@ always available.
.. data:: platform
- This string contains a platform identifier, e.g. ``'sunos5'`` or ``'linux1'``.
- This can be used to append platform-specific components to ``path``, for
- instance.
+ This string contains a platform identifier that can be used to append
+ platform-specific components to :data:`sys.path`, for instance.
+
+ For Unix systems, this is the lowercased OS name as returned by ``uname -s``
+ with the first part of the version as returned by ``uname -r`` appended,
+ e.g. ``'sunos5'`` or ``'linux2'``, *at the time when Python was built*.
+ For other systems, the values are:
+
+ ================ ===========================
+ System :data:`platform` value
+ ================ ===========================
+ Windows ``'win32'``
+ Windows/Cygwin ``'cygwin'``
+ MacOS X ``'darwin'``
+ MacOS 9 ``'mac'``
+ OS/2 ``'os2'``
+ OS/2 EMX ``'os2emx'``
+ RiscOS ``'riscos'``
+ AtheOS ``'atheos'``
+ ================ ===========================
.. data:: prefix
diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst
index 4b86e88..63fb53e 100644
--- a/Doc/library/urllib.rst
+++ b/Doc/library/urllib.rst
@@ -27,16 +27,17 @@ High-level interface
a server somewhere on the network. If the connection cannot be made the
:exc:`IOError` exception is raised. If all went well, a file-like object is
returned. This supports the following methods: :meth:`read`, :meth:`readline`,
- :meth:`readlines`, :meth:`fileno`, :meth:`close`, :meth:`info` and
+ :meth:`readlines`, :meth:`fileno`, :meth:`close`, :meth:`info`, :meth:`getcode` and
:meth:`geturl`. It also has proper support for the :term:`iterator` protocol. One
caveat: the :meth:`read` method, if the size argument is omitted or negative,
may not read until the end of the data stream; there is no good way to determine
that the entire stream from a socket has been read in the general case.
- Except for the :meth:`info` and :meth:`geturl` methods, these methods have the
- same interface as for file objects --- see section :ref:`bltin-file-objects` in
- this manual. (It is not a built-in file object, however, so it can't be used at
- those few places where a true built-in file object is required.)
+ Except for the :meth:`info`, :meth:`getcode` and :meth:`geturl` methods,
+ these methods have the same interface as for file objects --- see section
+ :ref:`bltin-file-objects` in this manual. (It is not a built-in file object,
+ however, so it can't be used at those few places where a true built-in file
+ object is required.)
.. index:: module: mimetools
@@ -58,6 +59,9 @@ High-level interface
the client was redirected to. The :meth:`geturl` method can be used to get at
this redirected URL.
+ The :meth:`getcode` method returns the HTTP status code that was sent with the
+ response, or ``None`` if the URL is no HTTP URL.
+
If the *url* uses the :file:`http:` scheme identifier, the optional *data*
argument may be given to specify a ``POST`` request (normally the request type
is ``GET``). The *data* argument must be in standard
@@ -75,6 +79,11 @@ High-level interface
% python
...
+ The :envvar:`no_proxy` environment variable can be used to specify hosts which
+ shouldn't be reached via proxy; if set, it should be a comma-separated list
+ of hostname suffixes, optionally with ``:port`` appended, for example
+ ``cern.ch,ncsa.uiuc.edu,some.host:8080``.
+
In a Windows environment, if no proxy environment variables are set, proxy
settings are obtained from the registry's Internet Settings section.