diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index c4816f5ed99..510544edb3d 100644 --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -28,10 +28,10 @@ Importing Modules leaves the module in ``sys.modules``. .. versionchanged:: 2.4 - failing imports remove incomplete module objects. + Failing imports remove incomplete module objects. .. versionchanged:: 2.6 - always use absolute imports + Always uses absolute imports. .. cfunction:: PyObject* PyImport_ImportModuleNoBlock(const char *name) @@ -62,7 +62,7 @@ Importing Modules unless a non-empty *fromlist* was given. .. versionchanged:: 2.4 - failing imports remove incomplete module objects. + Failing imports remove incomplete module objects. .. versionchanged:: 2.6 The function is an alias for :cfunc:`PyImport_ImportModuleLevel` with @@ -95,7 +95,7 @@ Importing Modules are installed in the current environment, e.g. by :mod:`rexec` or :mod:`ihooks`. .. versionchanged:: 2.6 - always use absolute imports + Always uses absolute imports. .. cfunction:: PyObject* PyImport_ReloadModule(PyObject *m) diff --git a/Doc/c-api/int.rst b/Doc/c-api/int.rst index ef82100324c..9ff0347d05c 100644 --- a/Doc/c-api/int.rst +++ b/Doc/c-api/int.rst @@ -68,6 +68,15 @@ Plain Integer Objects .. cfunction:: PyObject* PyInt_FromSsize_t(Py_ssize_t ival) + Create a new integer object with a value of *ival*. If the value is larger + than ``LONG_MAX`` or smaller than ``LONG_MIN``, a long integer object is + returned. + + .. versionadded:: 2.5 + + +.. cfunction:: PyObject* PyInt_FromSize_t(size_t ival) + Create a new integer object with a value of *ival*. If the value exceeds ``LONG_MAX``, a long integer object is returned. diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst index d052ec24c65..5c99c3db27a 100644 --- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -1219,16 +1219,23 @@ like this:: static int import_spam(void) { - PyObject *module = PyImport_ImportModule("spam"); + PyObject *c_api_object; + PyObject *module; - if (module != NULL) { - PyObject *c_api_object = PyObject_GetAttrString(module, "_C_API"); - if (c_api_object == NULL) - return -1; - if (PyCObject_Check(c_api_object)) - PySpam_API = (void **)PyCObject_AsVoidPtr(c_api_object); - Py_DECREF(c_api_object); + module = PyImport_ImportModule("spam"); + if (module == NULL) + return -1; + + c_api_object = PyObject_GetAttrString(module, "_C_API"); + if (c_api_object == NULL) { + Py_DECREF(module); + return -1; } + if (PyCObject_Check(c_api_object)) + PySpam_API = (void **)PyCObject_AsVoidPtr(c_api_object); + + Py_DECREF(c_api_object); + Py_DECREF(module); return 0; } diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 3b247b7700b..f7fb4e372c6 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -24,7 +24,7 @@ defined: +-----------+----------------+-------------------+-----------------------+ | ``'B'`` | unsigned char | int | 1 | +-----------+----------------+-------------------+-----------------------+ -| ``'u'`` | Py_UNICODE | Unicode character | 2 | +| ``'u'`` | Py_UNICODE | Unicode character | 2 (see note) | +-----------+----------------+-------------------+-----------------------+ | ``'h'`` | signed short | int | 2 | +-----------+----------------+-------------------+-----------------------+ @@ -43,6 +43,11 @@ defined: | ``'d'`` | double | float | 8 | +-----------+----------------+-------------------+-----------------------+ +.. note:: + + The ``'u'`` typecode corresponds to Python's unicode character. On narrow + Unicode builds this is 2-bytes, on wide builds this is 4-bytes. + The actual representation of values is determined by the machine architecture (strictly speaking, by the C implementation). The actual size can be accessed through the :attr:`itemsize` attribute. The values stored for ``'L'`` and @@ -53,9 +58,9 @@ unsigned (long) integers. The module defines the following type: -.. function:: array(typecode[, initializer]) +.. class:: array(typecode[, initializer]) - Return a new array whose items are restricted by *typecode*, and initialized + A new array whose items are restricted by *typecode*, and initialized from the optional *initializer* value, which must be a list, string, or iterable over elements of the appropriate type. @@ -70,7 +75,7 @@ The module defines the following type: .. data:: ArrayType - Obsolete alias for :func:`array`. + Obsolete alias for :class:`array`. Array objects support the ordinary sequence operations of indexing, slicing, concatenation, and multiplication. When using slice assignment, the assigned @@ -80,7 +85,6 @@ and may be used wherever buffer objects are supported. The following data items and methods are also supported: - .. attribute:: array.typecode The typecode character used to create the array. diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst index 3879e0d9f20..1e14e4b14dc 100644 --- a/Doc/library/cgi.rst +++ b/Doc/library/cgi.rst @@ -1,6 +1,5 @@ - -:mod:`cgi` --- Common Gateway Interface support. -================================================ +:mod:`cgi` --- Common Gateway Interface support +=============================================== .. module:: cgi :synopsis: Helpers for running Python scripts via the Common Gateway Interface. diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst index 935afeeba90..b5e9aa87998 100644 --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -1,6 +1,5 @@ - -:mod:`contextlib` --- Utilities for :keyword:`with`\ -statement contexts. -========================================================================= +:mod:`contextlib` --- Utilities for :keyword:`with`\ -statement contexts +======================================================================== .. module:: contextlib :synopsis: Utilities for with-statement contexts. diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index eca14d6a600..10e61de1434 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1,6 +1,5 @@ - -:mod:`ctypes` --- A foreign function library for Python. -======================================================== +:mod:`ctypes` --- A foreign function library for Python +======================================================= .. module:: ctypes :synopsis: A foreign function library for Python. diff --git a/Doc/library/curses.panel.rst b/Doc/library/curses.panel.rst index 59e5b86f191..a3c8bda63c2 100644 --- a/Doc/library/curses.panel.rst +++ b/Doc/library/curses.panel.rst @@ -1,6 +1,5 @@ - -:mod:`curses.panel` --- A panel stack extension for curses. -=========================================================== +:mod:`curses.panel` --- A panel stack extension for curses +========================================================== .. module:: curses.panel :synopsis: A panel stack extension that adds depth to curses windows. diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst index c3f1c51040a..01689a23a86 100644 --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -796,7 +796,8 @@ the following methods: Get a character. Note that the integer returned does *not* have to be in ASCII range: function keys, keypad keys and so on return numbers higher than 256. In - no-delay mode, -1 is returned if there is no input. + no-delay mode, -1 is returned if there is no input, else :func:`getch` waits + until a key is pressed. .. method:: window.getkey([y, x]) diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 6e45e84721e..ca902917d10 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -607,10 +607,9 @@ Decimal objects .. versionadded:: 2.6 - .. method:: logical_invert(other[, context]) + .. method:: logical_invert([context]) - :meth:`logical_invert` is a logical operation. The argument must - be a *logical operand* (see :ref:`logical_operands_label`). The + :meth:`logical_invert` is a logical operation. The result is the digit-wise inversion of the operand. .. versionadded:: 2.6 diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst index fa0b3cba976..b186d14f7a5 100644 --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -151,7 +151,6 @@ lay-out for the *lockdata* variable is system dependent --- therefore using the Module :mod:`os` If the locking flags :const:`O_SHLOCK` and :const:`O_EXLOCK` are present - in the :mod:`os` module, the :func:`os.open` function provides a more - platform-independent alternative to the :func:`lockf` and :func:`flock` - functions. + in the :mod:`os` module (on BSD only), the :func:`os.open` function + provides an alternative to the :func:`lockf` and :func:`flock` functions. diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst index 1d3c2f67097..cf4655b9f0b 100644 --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -34,16 +34,17 @@ This module provides an interface to the mechanisms used to implement the .. function:: find_module(name[, path]) - Try to find the module *name* on the search path *path*. If *path* is a list - of directory names, each directory is searched for files with any of the - suffixes returned by :func:`get_suffixes` above. Invalid names in the list - are silently ignored (but all list items must be strings). If *path* is - omitted or ``None``, the list of directory names given by ``sys.path`` is - searched, but first it searches a few special places: it tries to find a - built-in module with the given name (:const:`C_BUILTIN`), then a frozen - module (:const:`PY_FROZEN`), and on some systems some other places are looked - in as well (on Windows, it looks in the registry which may point to a - specific file). + Try to find the module *name*. If *path* is omitted or ``None``, the list of + directory names given by ``sys.path`` is searched, but first a few special + places are searched: the function tries to find a built-in module with the + given name (:const:`C_BUILTIN`), then a frozen module (:const:`PY_FROZEN`), + and on some systems some other places are looked in as well (on Windows, it + looks in the registry which may point to a specific file). + + Otherwise, *path* must be a list of directory names; each directory is + searched for files with any of the suffixes returned by :func:`get_suffixes` + above. Invalid names in the list are silently ignored (but all list items + must be strings). If search is successful, the return value is a 3-element tuple ``(file, pathname, description)``: diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst index 0366d779665..af2fd4b6f60 100644 --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -148,10 +148,124 @@ The :mod:`locale` module defines the following exception and functions: .. function:: nl_langinfo(option) - Return some locale-specific information as a string. This function is not - available on all systems, and the set of possible options might also vary across - platforms. The possible argument values are numbers, for which symbolic - constants are available in the locale module. + Return some locale-specific information as a string. This function is not + available on all systems, and the set of possible options might also vary + across platforms. The possible argument values are numbers, for which + symbolic constants are available in the locale module. + + The :func:`nl_langinfo` function accepts one of the following keys. Most + descriptions are taken from the corresponding description in the GNU C + library. + + .. data:: CODESET + + Get a string with the name of the character encoding used in the + selected locale. + + .. data:: D_T_FMT + + Get a string that can be used as a format string for :func:`strftime` to + represent time and date in a locale-specific way. + + .. data:: D_FMT + + Get a string that can be used as a format string for :func:`strftime` to + represent a date in a locale-specific way. + + .. data:: T_FMT + + Get a string that can be used as a format string for :func:`strftime` to + represent a time in a locale-specific way. + + .. data:: T_FMT_AMPM + + Get a format string for :func:`strftime` to represent time in the am/pm + format. + + .. data:: DAY_1 ... DAY_7 + + Get the name of the n-th day of the week. + + .. note:: + + This follows the US convention of :const:`DAY_1` being Sunday, not the + international convention (ISO 8601) that Monday is the first day of the + week. + + .. data:: ABDAY_1 ... ABDAY_7 + + Get the abbreviated name of the n-th day of the week. + + .. data:: MON_1 ... MON_12 + + Get the name of the n-th month. + + .. data:: ABMON_1 ... ABMON_12 + + Get the abbreviated name of the n-th month. + + .. data:: RADIXCHAR + + Get the radix character (decimal dot, decimal comma, etc.) + + .. data:: THOUSEP + + Get the separator character for thousands (groups of three digits). + + .. data:: YESEXPR + + Get a regular expression that can be used with the regex function to + recognize a positive response to a yes/no question. + + .. note:: + + The expression is in the syntax suitable for the :cfunc:`regex` function + from the C library, which might differ from the syntax used in :mod:`re`. + + .. data:: NOEXPR + + Get a regular expression that can be used with the regex(3) function to + recognize a negative response to a yes/no question. + + .. data:: CRNCYSTR + + Get the currency symbol, preceded by "-" if the symbol should appear before + the value, "+" if the symbol should appear after the value, or "." if the + symbol should replace the radix character. + + .. data:: ERA + + Get a string that represents the era used in the current locale. + + Most locales do not define this value. An example of a locale which does + define this value is the Japanese one. In Japan, the traditional + representation of dates includes the name of the era corresponding to the + then-emperor's reign. + + Normally it should not be necessary to use this value directly. Specifying + the ``E`` modifier in their format strings causes the :func:`strftime` + function to use this information. The format of the returned string is not + specified, and therefore you should not assume knowledge of it on different + systems. + + .. data:: ERA_YEAR + + Get the year in the relevant era of the locale. + + .. data:: ERA_D_T_FMT + + Get a format string for :func:`strftime` to represent dates and times in a + locale-specific era-based way. + + .. data:: ERA_D_FMT + + Get a format string for :func:`strftime` to represent time in a + locale-specific era-based way. + + .. data:: ALT_DIGITS + + Get a representation of up to 100 values used to represent the values + 0 to 99. .. function:: getdefaultlocale([envvars]) @@ -360,140 +474,13 @@ The :mod:`locale` module defines the following exception and functions: This is a symbolic constant used for different values returned by :func:`localeconv`. -The :func:`nl_langinfo` function accepts one of the following keys. Most -descriptions are taken from the corresponding description in the GNU C library. - - -.. data:: CODESET - - Return a string with the name of the character encoding used in the selected - locale. - - -.. data:: D_T_FMT - - Return a string that can be used as a format string for strftime(3) to represent - time and date in a locale-specific way. - - -.. data:: D_FMT - - Return a string that can be used as a format string for strftime(3) to represent - a date in a locale-specific way. - - -.. data:: T_FMT - - Return a string that can be used as a format string for strftime(3) to represent - a time in a locale-specific way. - - -.. data:: T_FMT_AMPM - - The return value can be used as a format string for 'strftime' to represent time - in the am/pm format. - - -.. data:: DAY_1 ... DAY_7 - - Return name of the n-th day of the week. - - .. note:: - - This follows the US convention of :const:`DAY_1` being Sunday, not the - international convention (ISO 8601) that Monday is the first day of the week. - - -.. data:: ABDAY_1 ... ABDAY_7 - - Return abbreviated name of the n-th day of the week. - - -.. data:: MON_1 ... MON_12 - - Return name of the n-th month. - - -.. data:: ABMON_1 ... ABMON_12 - - Return abbreviated name of the n-th month. - - -.. data:: RADIXCHAR - - Return radix character (decimal dot, decimal comma, etc.) - - -.. data:: THOUSEP - - Return separator character for thousands (groups of three digits). - - -.. data:: YESEXPR - - Return a regular expression that can be used with the regex function to - recognize a positive response to a yes/no question. - - .. note:: - - The expression is in the syntax suitable for the :cfunc:`regex` function from - the C library, which might differ from the syntax used in :mod:`re`. - - -.. data:: NOEXPR - - Return a regular expression that can be used with the regex(3) function to - recognize a negative response to a yes/no question. - - -.. data:: CRNCYSTR - - Return the currency symbol, preceded by "-" if the symbol should appear before - the value, "+" if the symbol should appear after the value, or "." if the symbol - should replace the radix character. - - -.. data:: ERA - - The return value represents the era used in the current locale. - - Most locales do not define this value. An example of a locale which does define - this value is the Japanese one. In Japan, the traditional representation of - dates includes the name of the era corresponding to the then-emperor's reign. - - Normally it should not be necessary to use this value directly. Specifying the - ``E`` modifier in their format strings causes the :func:`strftime` function to - use this information. The format of the returned string is not specified, and - therefore you should not assume knowledge of it on different systems. - - -.. data:: ERA_YEAR - - The return value gives the year in the relevant era of the locale. - - -.. data:: ERA_D_T_FMT - - This return value can be used as a format string for :func:`strftime` to - represent dates and times in a locale-specific era-based way. - - -.. data:: ERA_D_FMT - - This return value can be used as a format string for :func:`strftime` to - represent time in a locale-specific era-based way. - - -.. data:: ALT_DIGITS - - The return value is a representation of up to 100 values used to represent the - values 0 to 99. Example:: >>> import locale >>> loc = locale.getlocale() # get current locale - >>> locale.setlocale(locale.LC_ALL, 'de_DE') # use German locale; name might vary with platform + # use German locale; name might vary with platform + >>> locale.setlocale(locale.LC_ALL, 'de_DE') >>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut >>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale >>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 6a903eec3c0..4cca466406d 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -374,7 +374,9 @@ The :mod:`multiprocessing` package mostly replicates the API of the Note that a daemonic process is not allowed to create child processes. Otherwise a daemonic process would leave its children orphaned if it gets - terminated when its parent process exits. + terminated when its parent process exits. Additionally, these are **not** + Unix daemons or services, they are normal processes that will be + terminated (and not joined) if non-dameonic processes have exited. In addition to the :class:`Threading.Thread` API, :class:`Process` objects also support the following attributes and methods: @@ -1700,7 +1702,7 @@ authentication* using the :mod:`hmac` module. generally be omitted since it can usually be inferred from the format of *address*. (See :ref:`multiprocessing-address-formats`) - If *authentication* is ``True`` or *authkey* is a string then digest + If *authenticate* is ``True`` or *authkey* is a string then digest authentication is used. The key used for authentication will be either *authkey* or ``current_process().authkey)`` if *authkey* is ``None``. If authentication fails then :exc:`AuthenticationError` is raised. See @@ -1742,7 +1744,7 @@ authentication* using the :mod:`hmac` module. If *authkey* is ``None`` and *authenticate* is ``True`` then ``current_process().authkey`` is used as the authentication key. If - *authkey* is ``None`` and *authentication* is ``False`` then no + *authkey* is ``None`` and *authenticate* is ``False`` then no authentication is done. If authentication fails then :exc:`AuthenticationError` is raised. See :ref:`multiprocessing-auth-keys`. diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst index b8e09aa3589..5ac11c3c4e6 100644 --- a/Doc/library/optparse.rst +++ b/Doc/library/optparse.rst @@ -645,8 +645,8 @@ option involved in the error; be sure to do the same when calling :func:`OptionParser.error` from your application code. If :mod:`optparse`'s default error-handling behaviour does not suit your needs, -you'll need to subclass OptionParser and override its :meth:`exit` and/or -:meth:`error` methods. +you'll need to subclass OptionParser and override its :meth:`~OptionParser.exit` +and/or :meth:`~OptionParser.error` methods. .. _optparse-putting-it-all-together: diff --git a/Doc/library/pickletools.rst b/Doc/library/pickletools.rst index b07e3bdd84f..ea1619040d3 100644 --- a/Doc/library/pickletools.rst +++ b/Doc/library/pickletools.rst @@ -1,6 +1,5 @@ - -:mod:`pickletools` --- Tools for pickle developers. -=================================================== +:mod:`pickletools` --- Tools for pickle developers +================================================== .. module:: pickletools :synopsis: Contains extensive comments about the pickle protocols and pickle-machine diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index 9900278022b..98b7972d9bd 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -1,6 +1,5 @@ - -:mod:`platform` --- Access to underlying platform's identifying data. -====================================================================== +:mod:`platform` --- Access to underlying platform's identifying data +===================================================================== .. module:: platform :synopsis: Retrieves as much platform identifying data as possible. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index deebda7afc5..57f96a9b3d4 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -588,10 +588,18 @@ Implementations that do not obey this property are deemed broken. (This constraint was added in Python 2.3; in Python 2.2, various iterators are broken according to this rule.) + +.. _generator-types: + +Generator Types +--------------- + Python's :term:`generator`\s provide a convenient way to implement the iterator protocol. If a container object's :meth:`__iter__` method is implemented as a generator, it will automatically return an iterator object (technically, a -generator object) supplying the :meth:`__iter__` and :meth:`next` methods. +generator object) supplying the :meth:`__iter__` and :meth:`next` methods. More +information about generators can be found in :ref:`the documentation for the +yield expression `. .. _typesseq: diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 08b4103ac9b..50fe0626fc3 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -825,14 +825,15 @@ not be removed until Python 3.0. The functions defined in this module are: Return a copy of *s*, but with lower case letters converted to upper case. -.. function:: ljust(s, width) - rjust(s, width) - center(s, width) +.. function:: ljust(s, width[, fillchar]) + rjust(s, width[, fillchar]) + center(s, width[, fillchar]) These functions respectively left-justify, right-justify and center a string in a field of given width. They return a string that is at least *width* - characters wide, created by padding the string *s* with spaces until the given - width on the right, left or both sides. The string is never truncated. + characters wide, created by padding the string *s* with the character *fillchar* + (default is a space) until the given width on the right, left or both sides. + The string is never truncated. .. function:: zfill(s, width) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index c6bd07bea39..bc37d330e52 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -73,7 +73,11 @@ This module defines one class called :class:`Popen`: needed: Usually, the program to execute is defined by the *args* argument. If ``shell=True``, the *executable* argument specifies which shell to use. On Unix, the default shell is :file:`/bin/sh`. On Windows, the default shell is - specified by the :envvar:`COMSPEC` environment variable. + specified by the :envvar:`COMSPEC` environment variable. The only reason you + would need to specify ``shell=True`` on Windows is where the command you + wish to execute is actually built in to the shell, eg ``dir``, ``copy``. + You don't need ``shell=True`` to run a batch file, nor to run a console-based + executable. *stdin*, *stdout* and *stderr* specify the executed programs' standard input, standard output and standard error file handles, respectively. Valid values diff --git a/Doc/library/symtable.rst b/Doc/library/symtable.rst index 9ea3f01b407..9aafd4e13cb 100644 --- a/Doc/library/symtable.rst +++ b/Doc/library/symtable.rst @@ -144,6 +144,10 @@ Examining Symbol Tables Return ``True`` if the symbol is global. + .. method:: is_declared_global() + + Return ``True`` if the symbol is declared global with a global statement. + .. method:: is_local() Return ``True`` if the symbol is local to its block. diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index c545b971483..4f930b354fe 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -26,8 +26,9 @@ The module defines the following public class: The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to ``'pass'``; the timer - function is platform-dependent (see the module doc string). The statements may - contain newlines, as long as they don't contain multi-line string literals. + function is platform-dependent (see the module doc string). *stmt* and *setup* + may also contain multiple statements separated by ``;`` or newlines, as long as + they don't contain multi-line string literals. To measure the execution time of the first statement, use the :meth:`timeit` method. The :meth:`repeat` method is a convenience to call :meth:`timeit` diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst index 81e74528305..77fe5eed2ed 100644 --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -279,6 +279,8 @@ Available Functions be a string and *category* a subclass of :exc:`Warning`. :func:`warnpy3k` is using :exc:`DeprecationWarning` as default warning class. + .. versionadded:: 2.6 + .. function:: showwarning(message, category, filename, lineno[, file[, line]]) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index fa73ea2daf8..88b9b068c41 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -319,7 +319,7 @@ Miscellaneous options warning is triggered repeatedly for the same source line, such as inside a loop). ``module`` - Print each warning only only the first time it occurs in each module. + Print each warning only the first time it occurs in each module. ``once`` Print each warning only the first time it occurs in the program. ``error`` diff --git a/Misc/HISTORY b/Misc/HISTORY index 14f283d92d7..127b782c1f4 100644 --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -16184,7 +16184,7 @@ people seemed not to have picked it up. There's a Python script that fixes old code: demo/scripts/classfix.py. * There's a new reserved word: "access". The syntax and semantics are -still subject of of research and debate (as well as undocumented), but +still subject of research and debate (as well as undocumented), but the parser knows about the keyword so you must not use it as a variable, function, or attribute name. @@ -16434,7 +16434,7 @@ you could get away with the following: (a) define a function of one argument and call it with any number of arguments; if the actual argument count wasn't one, the function would receive a tuple containing the - arguments arguments (an empty tuple if there were none). + arguments (an empty tuple if there were none). (b) define a function of two arguments, and call it with more than two arguments; if there were more than two arguments, @@ -16756,7 +16756,7 @@ Changes to the source code that affect C extension writers ---------------------------------------------------------- The function strdup() no longer exists (it was used only in one places -and is somewhat of a a portability problem sice some systems have the +and is somewhat of a portability problem since some systems have the same function in their C library. The functions NEW() and RENEW() allocate one spare byte to guard diff --git a/Misc/NEWS b/Misc/NEWS index d265ef135d8..53d172113b9 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -3576,7 +3576,7 @@ Library - Bug #1565661: in webbrowser, split() the command for the default GNOME browser in case it is a command with args. -- Made the error message for time.strptime when the data data and +- Made the error message for time.strptime when the data and format do match be more clear. - Fix a bug in traceback.format_exception_only() that led to an error diff --git a/Misc/Porting b/Misc/Porting index 60ce9a8241d..1b94f141e9f 100644 --- a/Misc/Porting +++ b/Misc/Porting @@ -37,6 +37,6 @@ options. Then bang on it until it executes very simple Python statements. Now bang on it some more. At some point you'll want to use the os -module; this is the time to start thinking about what to to with the +module; this is the time to start thinking about what to do with the posix module. It's okay to simply #ifdef out those functions that cause problems; the remaining ones will be quite useful. diff --git a/Misc/cheatsheet b/Misc/cheatsheet index df69f244f68..98e3399ff9d 100644 --- a/Misc/cheatsheet +++ b/Misc/cheatsheet @@ -1145,7 +1145,7 @@ Exception> Standard methods & operators redefinition in classes Standard methods & operators map to special '__methods__' and thus may be - redefined (mostly in in user-defined classes), e.g.: + redefined (mostly in user-defined classes), e.g.: class x: def __init__(self, v): self.value = v def __add__(self, r): return self.value + r diff --git a/Misc/developers.txt b/Misc/developers.txt index b4f6c702aad..5b90e4c277c 100644 --- a/Misc/developers.txt +++ b/Misc/developers.txt @@ -41,7 +41,7 @@ Permissions History - Heiko Weinen was given SVN access on 29 April 2008 by MvL, for GSoC contributions. -- Jesus Cea was was given SVN access on 24 April 2008 by MvL, +- Jesus Cea was given SVN access on 24 April 2008 by MvL, for maintenance of bsddb. - Guilherme Polo was given SVN access on 24 April 2008 by MvL, diff --git a/Misc/python.man b/Misc/python.man index 1db77eaac5a..fd9ed457604 100644 --- a/Misc/python.man +++ b/Misc/python.man @@ -204,7 +204,7 @@ to print a warning each time it occurs (this may generate many messages if a warning is triggered repeatedly for the same source line, such as inside a loop); .B module -to print each warning only only the first time it occurs in each +to print each warning only the first time it occurs in each module; .B once to print each warning only the first time it occurs in the program; or