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/c-api/long.rst

    r2 r391  
    99
    1010
    11 .. ctype:: PyLongObject
    12 
    13    This subtype of :ctype:`PyObject` represents a Python long integer object.
    14 
    15 
    16 .. cvar:: PyTypeObject PyLong_Type
     11.. c:type:: PyLongObject
     12
     13   This subtype of :c:type:`PyObject` represents a Python long integer object.
     14
     15
     16.. c:var:: PyTypeObject PyLong_Type
    1717
    1818   .. index:: single: LongType (in modules types)
    1919
    20    This instance of :ctype:`PyTypeObject` represents the Python long integer type.
     20   This instance of :c:type:`PyTypeObject` represents the Python long integer type.
    2121   This is the same object as ``long`` and ``types.LongType``.
    2222
    2323
    24 .. cfunction:: int PyLong_Check(PyObject *p)
    25 
    26    Return true if its argument is a :ctype:`PyLongObject` or a subtype of
    27    :ctype:`PyLongObject`.
     24.. c:function:: int PyLong_Check(PyObject *p)
     25
     26   Return true if its argument is a :c:type:`PyLongObject` or a subtype of
     27   :c:type:`PyLongObject`.
    2828
    2929   .. versionchanged:: 2.2
     
    3131
    3232
    33 .. cfunction:: int PyLong_CheckExact(PyObject *p)
    34 
    35    Return true if its argument is a :ctype:`PyLongObject`, but not a subtype of
    36    :ctype:`PyLongObject`.
     33.. c:function:: int PyLong_CheckExact(PyObject *p)
     34
     35   Return true if its argument is a :c:type:`PyLongObject`, but not a subtype of
     36   :c:type:`PyLongObject`.
    3737
    3838   .. versionadded:: 2.2
    3939
    4040
    41 .. cfunction:: PyObject* PyLong_FromLong(long v)
    42 
    43    Return a new :ctype:`PyLongObject` object from *v*, or *NULL* on failure.
    44 
    45 
    46 .. cfunction:: PyObject* PyLong_FromUnsignedLong(unsigned long v)
    47 
    48    Return a new :ctype:`PyLongObject` object from a C :ctype:`unsigned long`, or
    49    *NULL* on failure.
    50 
    51 
    52 .. cfunction:: PyObject* PyLong_FromSsize_t(Py_ssize_t v)
    53 
    54    Return a new :ctype:`PyLongObject` object from a C :ctype:`Py_ssize_t`, or
    55    *NULL* on failure.
    56 
    57    .. versionadded:: 2.6
    58 
    59 
    60 .. cfunction:: PyObject* PyLong_FromSize_t(size_t v)
    61 
    62    Return a new :ctype:`PyLongObject` object from a C :ctype:`size_t`, or
    63    *NULL* on failure.
    64 
    65    .. versionadded:: 2.6
    66 
    67 
    68 .. cfunction:: PyObject* PyLong_FromLongLong(PY_LONG_LONG v)
    69 
    70    Return a new :ctype:`PyLongObject` object from a C :ctype:`long long`, or *NULL*
     41.. c:function:: PyObject* PyLong_FromLong(long v)
     42
     43   Return a new :c:type:`PyLongObject` object from *v*, or *NULL* on failure.
     44
     45
     46.. c:function:: PyObject* PyLong_FromUnsignedLong(unsigned long v)
     47
     48   Return a new :c:type:`PyLongObject` object from a C :c:type:`unsigned long`, or
     49   *NULL* on failure.
     50
     51
     52.. c:function:: PyObject* PyLong_FromSsize_t(Py_ssize_t v)
     53
     54   Return a new :c:type:`PyLongObject` object from a C :c:type:`Py_ssize_t`, or
     55   *NULL* on failure.
     56
     57   .. versionadded:: 2.6
     58
     59
     60.. c:function:: PyObject* PyLong_FromSize_t(size_t v)
     61
     62   Return a new :c:type:`PyLongObject` object from a C :c:type:`size_t`, or
     63   *NULL* on failure.
     64
     65   .. versionadded:: 2.6
     66
     67
     68.. c:function:: PyObject* PyLong_FromSsize_t(Py_ssize_t v)
     69
     70   Return a new :c:type:`PyLongObject` object with a value of *v*, or *NULL*
    7171   on failure.
    7272
    73 
    74 .. cfunction:: PyObject* PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG v)
    75 
    76    Return a new :ctype:`PyLongObject` object from a C :ctype:`unsigned long long`,
     73   .. versionadded:: 2.6
     74
     75
     76.. c:function:: PyObject* PyLong_FromSize_t(size_t v)
     77
     78   Return a new :c:type:`PyLongObject` object with a value of *v*, or *NULL*
     79   on failure.
     80
     81   .. versionadded:: 2.6
     82
     83
     84.. c:function:: PyObject* PyLong_FromLongLong(PY_LONG_LONG v)
     85
     86   Return a new :c:type:`PyLongObject` object from a C :c:type:`long long`, or *NULL*
     87   on failure.
     88
     89
     90.. c:function:: PyObject* PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG v)
     91
     92   Return a new :c:type:`PyLongObject` object from a C :c:type:`unsigned long long`,
    7793   or *NULL* on failure.
    7894
    7995
    80 .. cfunction:: PyObject* PyLong_FromDouble(double v)
    81 
    82    Return a new :ctype:`PyLongObject` object from the integer part of *v*, or
    83    *NULL* on failure.
    84 
    85 
    86 .. cfunction:: PyObject* PyLong_FromString(char *str, char **pend, int base)
    87 
    88    Return a new :ctype:`PyLongObject` based on the string value in *str*, which is
     96.. c:function:: PyObject* PyLong_FromDouble(double v)
     97
     98   Return a new :c:type:`PyLongObject` object from the integer part of *v*, or
     99   *NULL* on failure.
     100
     101
     102.. c:function:: PyObject* PyLong_FromString(char *str, char **pend, int base)
     103
     104   Return a new :c:type:`PyLongObject` based on the string value in *str*, which is
    89105   interpreted according to the radix in *base*.  If *pend* is non-*NULL*,
    90    ``*pend`` will point to the first character in *str* which follows the
     106   *\*pend* will point to the first character in *str* which follows the
    91107   representation of the number.  If *base* is ``0``, the radix will be determined
    92108   based on the leading characters of *str*: if *str* starts with ``'0x'`` or
     
    97113
    98114
    99 .. cfunction:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
     115.. c:function:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
    100116
    101117   Convert a sequence of Unicode digits to a Python long integer value.  The first
     
    108124
    109125   .. versionchanged:: 2.5
    110       This function used an :ctype:`int` for *length*. This might require
     126      This function used an :c:type:`int` for *length*. This might require
    111127      changes in your code for properly supporting 64-bit systems.
    112128
    113129
    114 .. cfunction:: PyObject* PyLong_FromVoidPtr(void *p)
     130.. c:function:: PyObject* PyLong_FromVoidPtr(void *p)
    115131
    116132   Create a Python integer or long integer from the pointer *p*. The pointer value
    117    can be retrieved from the resulting value using :cfunc:`PyLong_AsVoidPtr`.
     133   can be retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`.
    118134
    119135   .. versionadded:: 1.5.2
     
    123139
    124140
    125 .. cfunction:: long PyLong_AsLong(PyObject *pylong)
     141.. c:function:: long PyLong_AsLong(PyObject *pylong)
    126142
    127143   .. index::
     
    129145      single: OverflowError (built-in exception)
    130146
    131    Return a C :ctype:`long` representation of the contents of *pylong*.  If
     147   Return a C :c:type:`long` representation of the contents of *pylong*.  If
    132148   *pylong* is greater than :const:`LONG_MAX`, an :exc:`OverflowError` is raised
    133149   and ``-1`` will be returned.
    134150
    135151
    136 .. cfunction:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong)
     152.. c:function:: long PyLong_AsLongAndOverflow(PyObject *pylong, int *overflow)
     153
     154   Return a C :c:type:`long` representation of the contents of
     155   *pylong*.  If *pylong* is greater than :const:`LONG_MAX` or less
     156   than :const:`LONG_MIN`, set *\*overflow* to ``1`` or ``-1``,
     157   respectively, and return ``-1``; otherwise, set *\*overflow* to
     158   ``0``.  If any other exception occurs (for example a TypeError or
     159   MemoryError), then ``-1`` will be returned and *\*overflow* will
     160   be ``0``.
     161
     162   .. versionadded:: 2.7
     163
     164
     165.. c:function:: PY_LONG_LONG PyLong_AsLongLongAndOverflow(PyObject *pylong, int *overflow)
     166
     167   Return a C :c:type:`long long` representation of the contents of
     168   *pylong*.  If *pylong* is greater than :const:`PY_LLONG_MAX` or less
     169   than :const:`PY_LLONG_MIN`, set *\*overflow* to ``1`` or ``-1``,
     170   respectively, and return ``-1``; otherwise, set *\*overflow* to
     171   ``0``.  If any other exception occurs (for example a TypeError or
     172   MemoryError), then ``-1`` will be returned and *\*overflow* will
     173   be ``0``.
     174
     175   .. versionadded:: 2.7
     176
     177
     178.. c:function:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong)
    137179
    138180   .. index::
     
    140182      single: OverflowError (built-in exception)
    141183
    142    Return a C :ctype:`Py_ssize_t` representation of the contents of *pylong*.  If
     184   Return a C :c:type:`Py_ssize_t` representation of the contents of *pylong*.  If
    143185   *pylong* is greater than :const:`PY_SSIZE_T_MAX`, an :exc:`OverflowError` is raised
    144186   and ``-1`` will be returned.
     
    147189
    148190
    149 .. cfunction:: unsigned long PyLong_AsUnsignedLong(PyObject *pylong)
     191.. c:function:: unsigned long PyLong_AsUnsignedLong(PyObject *pylong)
    150192
    151193   .. index::
     
    153195      single: OverflowError (built-in exception)
    154196
    155    Return a C :ctype:`unsigned long` representation of the contents of *pylong*.
     197   Return a C :c:type:`unsigned long` representation of the contents of *pylong*.
    156198   If *pylong* is greater than :const:`ULONG_MAX`, an :exc:`OverflowError` is
    157199   raised.
    158200
    159201
    160 .. cfunction:: PY_LONG_LONG PyLong_AsLongLong(PyObject *pylong)
    161 
    162    Return a C :ctype:`long long` from a Python long integer.  If *pylong* cannot be
    163    represented as a :ctype:`long long`, an :exc:`OverflowError` will be raised.
     202.. c:function:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong)
     203
     204   .. index::
     205      single: PY_SSIZE_T_MAX
     206
     207   Return a :c:type:`Py_ssize_t` representation of the contents of *pylong*.  If
     208   *pylong* is greater than :const:`PY_SSIZE_T_MAX`, an :exc:`OverflowError` is
     209   raised.
     210
     211   .. versionadded:: 2.6
     212
     213
     214.. c:function:: PY_LONG_LONG PyLong_AsLongLong(PyObject *pylong)
     215
     216   .. index::
     217      single: OverflowError (built-in exception)
     218
     219   Return a C :c:type:`long long` from a Python long integer.  If
     220   *pylong* cannot be represented as a :c:type:`long long`, an
     221   :exc:`OverflowError` is raised and ``-1`` is returned.
    164222
    165223   .. versionadded:: 2.2
    166224
    167225
    168 .. cfunction:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *pylong)
    169 
    170    Return a C :ctype:`unsigned long long` from a Python long integer. If *pylong*
    171    cannot be represented as an :ctype:`unsigned long long`, an :exc:`OverflowError`
    172    will be raised if the value is positive, or a :exc:`TypeError` will be raised if
    173    the value is negative.
     226.. c:function:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *pylong)
     227
     228   .. index::
     229      single: OverflowError (built-in exception)
     230
     231   Return a C :c:type:`unsigned long long` from a Python long integer. If
     232   *pylong* cannot be represented as an :c:type:`unsigned long long`, an
     233   :exc:`OverflowError` is raised and ``(unsigned long long)-1`` is
     234   returned.
    174235
    175236   .. versionadded:: 2.2
    176237
    177 
    178 .. cfunction:: unsigned long PyLong_AsUnsignedLongMask(PyObject *io)
    179 
    180    Return a C :ctype:`unsigned long` from a Python long integer, without checking
     238   .. versionchanged:: 2.7
     239      A negative *pylong* now raises :exc:`OverflowError`, not
     240      :exc:`TypeError`.
     241
     242
     243.. c:function:: unsigned long PyLong_AsUnsignedLongMask(PyObject *io)
     244
     245   Return a C :c:type:`unsigned long` from a Python long integer, without checking
    181246   for overflow.
    182247
     
    184249
    185250
    186 .. cfunction:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask(PyObject *io)
    187 
    188    Return a C :ctype:`unsigned long long` from a Python long integer, without
     251.. c:function:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask(PyObject *io)
     252
     253   Return a C :c:type:`unsigned long long` from a Python long integer, without
    189254   checking for overflow.
    190255
     
    192257
    193258
    194 .. cfunction:: double PyLong_AsDouble(PyObject *pylong)
    195 
    196    Return a C :ctype:`double` representation of the contents of *pylong*.  If
    197    *pylong* cannot be approximately represented as a :ctype:`double`, an
     259.. c:function:: double PyLong_AsDouble(PyObject *pylong)
     260
     261   Return a C :c:type:`double` representation of the contents of *pylong*.  If
     262   *pylong* cannot be approximately represented as a :c:type:`double`, an
    198263   :exc:`OverflowError` exception is raised and ``-1.0`` will be returned.
    199264
    200265
    201 .. cfunction:: void* PyLong_AsVoidPtr(PyObject *pylong)
    202 
    203    Convert a Python integer or long integer *pylong* to a C :ctype:`void` pointer.
     266.. c:function:: void* PyLong_AsVoidPtr(PyObject *pylong)
     267
     268   Convert a Python integer or long integer *pylong* to a C :c:type:`void` pointer.
    204269   If *pylong* cannot be converted, an :exc:`OverflowError` will be raised.  This
    205    is only assured to produce a usable :ctype:`void` pointer for values created
    206    with :cfunc:`PyLong_FromVoidPtr`.
     270   is only assured to produce a usable :c:type:`void` pointer for values created
     271   with :c:func:`PyLong_FromVoidPtr`.
    207272
    208273   .. versionadded:: 1.5.2
Note: See TracChangeset for help on using the changeset viewer.