diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/buffer.rst | 2 | ||||
-rw-r--r-- | Doc/c-api/sequence.rst | 10 | ||||
-rw-r--r-- | Doc/conf.py | 3 | ||||
-rw-r--r-- | Doc/library/ctypes.rst | 3 | ||||
-rw-r--r-- | Doc/library/email-examples.rst | 2 | ||||
-rw-r--r-- | Doc/library/exceptions.rst | 6 | ||||
-rw-r--r-- | Doc/library/functions.rst | 4 | ||||
-rw-r--r-- | Doc/library/http.client.rst | 2 | ||||
-rw-r--r-- | Doc/library/os.rst | 31 | ||||
-rw-r--r-- | Doc/library/rlcompleter.rst | 2 | ||||
-rw-r--r-- | Doc/library/smtplib.rst | 5 | ||||
-rw-r--r-- | Doc/library/subprocess.rst | 9 | ||||
-rw-r--r-- | Doc/reference/simple_stmts.rst | 8 |
13 files changed, 50 insertions, 37 deletions
diff --git a/Doc/c-api/buffer.rst b/Doc/c-api/buffer.rst index a75e450..6ad4f7b 100644 --- a/Doc/c-api/buffer.rst +++ b/Doc/c-api/buffer.rst @@ -137,7 +137,7 @@ Buffer related functions Return 1 if *obj* supports the buffer interface otherwise 0. -.. cfunction:: int PyObject_GetBuffer(PyObject *obj, PyObject *view, int flags) +.. cfunction:: int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags) Export *obj* into a :ctype:`Py_buffer`, *view*. These arguments must never be *NULL*. The *flags* argument is a bit field indicating what diff --git a/Doc/c-api/sequence.rst b/Doc/c-api/sequence.rst index 6be9810..d863177 100644 --- a/Doc/c-api/sequence.rst +++ b/Doc/c-api/sequence.rst @@ -50,7 +50,7 @@ Sequence Protocol .. cfunction:: PyObject* PySequence_GetItem(PyObject *o, Py_ssize_t i) - Return the *i*th element of *o*, or *NULL* on failure. This is the equivalent of + Return the *i*\ th element of *o*, or *NULL* on failure. This is the equivalent of the Python expression ``o[i]``. @@ -62,14 +62,14 @@ Sequence Protocol .. cfunction:: int PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v) - Assign object *v* to the *i*th element of *o*. Returns ``-1`` on failure. This + Assign object *v* to the *i*\ th element of *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``o[i] = v``. This function *does not* steal a reference to *v*. .. cfunction:: int PySequence_DelItem(PyObject *o, Py_ssize_t i) - Delete the *i*th element of object *o*. Returns ``-1`` on failure. This is the + Delete the *i*\ th element of object *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o[i]``. @@ -131,7 +131,7 @@ Sequence Protocol .. cfunction:: PyObject* PySequence_Fast_GET_ITEM(PyObject *o, Py_ssize_t i) - Return the *i*th element of *o*, assuming that *o* was returned by + Return the *i*\ th element of *o*, assuming that *o* was returned by :cfunc:`PySequence_Fast`, *o* is not *NULL*, and that *i* is within bounds. @@ -147,7 +147,7 @@ Sequence Protocol .. cfunction:: PyObject* PySequence_ITEM(PyObject *o, Py_ssize_t i) - Return the *i*th element of *o* or *NULL* on failure. Macro form of + Return the *i*\ th element of *o* or *NULL* on failure. Macro form of :cfunc:`PySequence_GetItem` but without checking that :cfunc:`PySequence_Check(o)` is true and without adjustment for negative indices. diff --git a/Doc/conf.py b/Doc/conf.py index 551452b..352c15f 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -46,6 +46,9 @@ unused_docs = [ 'library/xml.etree', ] +# Ignore .rst in Sphinx its self. +exclude_trees = ['tools/sphinx'] + # Relative filename of the reference count data file. refcount_file = 'data/refcounts.dat' diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index ba80478..039289a 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1207,8 +1207,7 @@ constructs a new Python object each time! Variable-sized data types ^^^^^^^^^^^^^^^^^^^^^^^^^ -``ctypes`` provides some support for variable-sized arrays and structures (this -was added in version 0.9.9.7). +``ctypes`` provides some support for variable-sized arrays and structures. The ``resize`` function can be used to resize the memory buffer of an existing ctypes object. The function takes the object as first argument, and the diff --git a/Doc/library/email-examples.rst b/Doc/library/email-examples.rst index f606f9b..c1b16da 100644 --- a/Doc/library/email-examples.rst +++ b/Doc/library/email-examples.rst @@ -1,3 +1,5 @@ +.. _email-examples: + :mod:`email`: Examples ---------------------- diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index 7d8e1b3..43fa9b0 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -73,9 +73,9 @@ The following exceptions are only used as base classes for other exceptions. .. exception:: LookupError - The base class for the exceptions that are raised when a key or index used on a - mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. This can be - raised directly by :func:`sys.setdefaultencoding`. + The base class for the exceptions that are raised when a key or index used on + a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. This + can be raised directly by :func:`codecs.lookup`. .. exception:: EnvironmentError diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index f0c7195..732dfa2 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1209,7 +1209,7 @@ are always available. They are listed here in alphabetical order. >>> list(zipped) [(1, 4), (2, 5), (3, 6)] >>> x2, y2 = zip(*zip(x, y)) - >>> x == x2, y == y2 + >>> x == list(x2) and y == list(y2) True @@ -1272,7 +1272,7 @@ are always available. They are listed here in alphabetical order. names. If you simply want to import a module (potentially within a package) by name, - you can get it from :data:`sys.modules`:: + you can call :func:`__import__` and then look it up in :data:`sys.modules`:: >>> import sys >>> name = 'foo.bar.baz' diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 8362948..3632242 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -384,6 +384,8 @@ HTTPConnection Objects Set the debugging level (the amount of debugging output printed). The default debug level is ``0``, meaning no debugging output is printed. + .. versionadded:: 2.7 + .. method:: HTTPConnection.connect() diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 2213740..9bb2fc6 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -386,9 +386,9 @@ by file descriptors. .. note:: This function is intended for low-level I/O and must be applied to a file - descriptor as returned by :func:`open` or :func:`pipe`. To close a "file + descriptor as returned by :func:`os.open` or :func:`pipe`. To close a "file object" returned by the built-in function :func:`open` or by :func:`popen` or - :func:`fdopen`, use its :meth:`close` method. + :func:`fdopen`, use its :meth:`~file.close` method. .. function:: closerange(fd_low, fd_high) @@ -439,6 +439,9 @@ by file descriptors. Force write of file with filedescriptor *fd* to disk. Does not force update of metadata. Availability: Unix. + .. note:: + This function is not available on MacOS. + .. function:: fpathconf(fd, name) @@ -514,8 +517,8 @@ by file descriptors. .. note:: This function is intended for low-level I/O. For normal usage, use the built-in - function :func:`open`, which returns a "file object" with :meth:`read` and - :meth:`write` methods (and many more). To wrap a file descriptor in a "file + function :func:`open`, which returns a "file object" with :meth:`~file.read` and + :meth:`~file.write` methods (and many more). To wrap a file descriptor in a "file object", use :func:`fdopen`. @@ -544,22 +547,22 @@ by file descriptors. .. note:: This function is intended for low-level I/O and must be applied to a file - descriptor as returned by :func:`open` or :func:`pipe`. To read a "file object" + 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:`read` or :meth:`readline` - methods. + :func:`fdopen`, or :data:`sys.stdin`, use its :meth:`~file.read` or + :meth:`~file.readline` methods. .. function:: tcgetpgrp(fd) Return the process group associated with the terminal given by *fd* (an open - file descriptor as returned by :func:`open`). Availability: Unix. + file descriptor as returned by :func:`os.open`). Availability: Unix. .. function:: tcsetpgrp(fd, pg) Set the process group associated with the terminal given by *fd* (an open file - descriptor as returned by :func:`open`) to *pg*. Availability: Unix. + descriptor as returned by :func:`os.open`) to *pg*. Availability: Unix. .. function:: ttyname(fd) @@ -577,13 +580,13 @@ by file descriptors. .. note:: This function is intended for low-level I/O and must be applied to a file - descriptor as returned by :func:`open` or :func:`pipe`. To write a "file + descriptor as returned by :func:`os.open` or :func:`pipe`. To write a "file object" returned by the built-in function :func:`open` or by :func:`popen` or - :func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use its :meth:`write` - method. + :func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use its + :meth:`~file.write` method. The following constants are options for the *flags* parameter to the -:func:`open` function. They can be combined using the bitwise OR operator +: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 or `the MSDN <http://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>` on Windows. @@ -660,7 +663,7 @@ Files and Directories .. note:: 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 + actually doing so using :func:`open` creates a security hole, because the user might exploit the short time interval between checking and opening the file to manipulate it. diff --git a/Doc/library/rlcompleter.rst b/Doc/library/rlcompleter.rst index 293160a..6b3befc 100644 --- a/Doc/library/rlcompleter.rst +++ b/Doc/library/rlcompleter.rst @@ -52,7 +52,7 @@ Completer objects have the following method: .. method:: Completer.complete(text, state) - Return the *state*th completion for *text*. + Return the *state*\ th completion for *text*. If called for *text* that doesn't include a period character (``'.'``), it will complete from names currently defined in :mod:`__main__`, :mod:`builtins` and diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst index 5363120..070220e 100644 --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -364,3 +364,8 @@ example doesn't do any processing of the :rfc:`822` headers. In particular, the server.sendmail(fromaddr, toaddrs, msg) server.quit() +.. note:: + + In general, you will want to use the :mod:`email` package's features to + construct an email message, which you can then convert to a string and send + via :meth:`sendmail`; see :ref:`email-examples`. diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 9853e62..3318d43 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -34,9 +34,12 @@ This module defines one class called :class:`Popen`: Arguments are: *args* should be a string, or a sequence of program arguments. The program - to execute is normally the first item in the args sequence or the string if a - string is given, but can be explicitly set by using the *executable* - argument. + to execute is normally the first item in the args sequence or the string if + a string is given, but can be explicitly set by using the *executable* + argument. When *executable* is given, the first item in the args sequence + is still treated by most programs as the command name, which can then be + different from the actual executable name. On Unix, it becomes the display + name for the executing program in utilities such as :program:`ps`. On Unix, with *shell=False* (default): In this case, the Popen class uses :meth:`os.execvp` to execute the child program. *args* should normally be a diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst index dc8d2cf..ced3398 100644 --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -815,12 +815,8 @@ then you will end up importing ``pkg.mod``. If you execute ``from ..subpkg2 imprt mod`` from within ``pkg.subpkg1`` you will import ``pkg.subpkg2.mod``. The specification for relative imports is contained within :pep:`328`. - -.. index:: builtin: __import__ - -The built-in function :func:`__import__` is provided to support applications -that determine which modules need to be loaded dynamically; refer to -:ref:`built-in-funcs` for additional information. +:func:`importlib.import_module` is provided to support applications that +determine which modules need to be loaded dynamically. .. _future: |