Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/exceptions.rst

    r2 r391  
    2727The built-in exceptions listed below can be generated by the interpreter or
    2828built-in functions.  Except where mentioned, they have an "associated value"
    29 indicating the detailed cause of the error. This may be a string or a tuple
     29indicating the detailed cause of the error.  This may be a string or a tuple
    3030containing several items of information (e.g., an error code and a string
    3131explaining the code). The associated value is the second argument to the
     
    4747The following exceptions are only used as base classes for other exceptions.
    4848
    49 
    5049.. exception:: BaseException
    5150
    5251   The base class for all built-in exceptions.  It is not meant to be directly
    53    inherited by user-defined classes (for that use :exc:`Exception`).  If
     52   inherited by user-defined classes (for that, use :exc:`Exception`).  If
    5453   :func:`str` or :func:`unicode` is called on an instance of this class, the
    55    representation of the argument(s) to the instance are returned or the empty
    56    string when there were no arguments.  All arguments are  stored in :attr:`args`
    57    as a tuple.
     54   representation of the argument(s) to the instance are returned, or the empty
     55   string when there were no arguments.
    5856
    5957   .. versionadded:: 2.5
     58
     59   .. attribute:: args
     60
     61      The tuple of arguments given to the exception constructor.  Some built-in
     62      exceptions (like :exc:`IOError`) expect a certain number of arguments and
     63      assign a special meaning to the elements of this tuple, while others are
     64      usually called only with a single string giving an error message.
    6065
    6166
     
    8186   arithmetic errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`,
    8287   :exc:`FloatingPointError`.
     88
     89
     90.. exception:: BufferError
     91
     92   Raised when a :ref:`buffer <bufferobjects>` related operation cannot be
     93   performed.
    8394
    8495
     
    142153   Raised when a floating point operation fails.  This exception is always defined,
    143154   but can only be raised when Python is configured with the
    144    :option:`--with-fpectl` option, or the :const:`WANT_SIGFPE_HANDLER` symbol is
     155   ``--with-fpectl`` option, or the :const:`WANT_SIGFPE_HANDLER` symbol is
    145156   defined in the :file:`pyconfig.h` file.
    146157
     
    210221   rescued (by deleting some objects).  The associated value is a string indicating
    211222   what kind of (internal) operation ran out of memory. Note that because of the
    212    underlying memory management architecture (C's :cfunc:`malloc` function), the
     223   underlying memory management architecture (C's :c:func:`malloc` function), the
    213224   interpreter may not always be able to completely recover from this situation; it
    214225   nevertheless raises an exception so that a stack traceback can be printed, in
     
    239250   function returns a system-related error (not for illegal argument types or
    240251   other incidental errors).  The :attr:`errno` attribute is a numeric error
    241    code from :cdata:`errno`, and the :attr:`strerror` attribute is the
    242    corresponding string, as would be printed by the C function :cfunc:`perror`.
     252   code from :c:data:`errno`, and the :attr:`strerror` attribute is the
     253   corresponding string, as would be printed by the C function :c:func:`perror`.
    243254   See the module :mod:`errno`, which contains names for the error codes defined
    244255   by the underlying operating system.
     
    302313
    303314
     315.. exception:: IndentationError
     316
     317   Base class for syntax errors related to incorrect indentation.  This is a
     318   subclass of :exc:`SyntaxError`.
     319
     320
     321.. exception:: TabError
     322
     323   Raised when indentation contains an inconsistent use of tabs and spaces.
     324   This is a subclass of :exc:`IndentationError`.
     325
     326
    304327.. exception:: SystemError
    305328
     
    320343   handled, the Python interpreter exits; no stack traceback is printed.  If the
    321344   associated value is a plain integer, it specifies the system exit status (passed
    322    to C's :cfunc:`exit` function); if it is ``None``, the exit status is zero; if
     345   to C's :c:func:`exit` function); if it is ``None``, the exit status is zero; if
    323346   it has another type (such as a string), the object's value is printed and the
    324347   exit status is one.
    325348
    326    Instances have an attribute :attr:`code` which is set to the proposed exit
     349   Instances have an attribute :attr:`!code` which is set to the proposed exit
    327350   status or error message (defaulting to ``None``). Also, this exception derives
    328351   directly from :exc:`BaseException` and not :exc:`StandardError`, since it is not
     
    334357   of losing control.  The :func:`os._exit` function can be used if it is
    335358   absolutely positively necessary to exit immediately (for example, in the child
    336    process after a call to :func:`fork`).
     359   process after a call to :func:`os.fork`).
    337360
    338361   The exception inherits from :exc:`BaseException` instead of :exc:`StandardError`
     
    365388   subclass of :exc:`ValueError`.
    366389
     390   :exc:`UnicodeError` has attributes that describe the encoding or decoding
     391   error.  For example, ``err.object[err.start:err.end]`` gives the particular
     392   invalid input that the codec failed on.
     393
     394   .. attribute:: encoding
     395
     396       The name of the encoding that raised the error.
     397
     398   .. attribute:: reason
     399
     400       A string describing the specific codec error.
     401
     402   .. attribute:: object
     403
     404       The object the codec was attempting to encode or decode.
     405
     406   .. attribute:: start
     407
     408       The first index of invalid data in :attr:`object`.
     409
     410   .. attribute:: end
     411
     412       The index after the last invalid data in :attr:`object`.
     413
    367414   .. versionadded:: 2.0
    368415
     
    407454
    408455   Raised when a Windows-specific error occurs or when the error number does not
    409    correspond to an :cdata:`errno` value.  The :attr:`winerror` and
     456   correspond to an :c:data:`errno` value.  The :attr:`winerror` and
    410457   :attr:`strerror` values are created from the return values of the
    411    :cfunc:`GetLastError` and :cfunc:`FormatMessage` functions from the Windows
     458   :c:func:`GetLastError` and :c:func:`FormatMessage` functions from the Windows
    412459   Platform API. The :attr:`errno` value maps the :attr:`winerror` value to
    413460   corresponding ``errno.h`` values. This is a subclass of :exc:`OSError`.
     
    416463
    417464   .. versionchanged:: 2.5
    418       Previous versions put the :cfunc:`GetLastError` codes into :attr:`errno`.
     465      Previous versions put the :c:func:`GetLastError` codes into :attr:`errno`.
    419466
    420467
Note: See TracChangeset for help on using the changeset viewer.