Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

Location:
python/vendor/current/Include
Files:
4 added
55 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Include/Python-ast.h

    r2 r388  
    186186
    187187enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
    188                   IfExp_kind=5, Dict_kind=6, ListComp_kind=7,
    189                   GeneratorExp_kind=8, Yield_kind=9, Compare_kind=10,
    190                   Call_kind=11, Repr_kind=12, Num_kind=13, Str_kind=14,
    191                   Attribute_kind=15, Subscript_kind=16, Name_kind=17,
    192                   List_kind=18, Tuple_kind=19};
     188                  IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8,
     189                  SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11,
     190                  Yield_kind=12, Compare_kind=13, Call_kind=14, Repr_kind=15,
     191                  Num_kind=16, Str_kind=17, Attribute_kind=18,
     192                  Subscript_kind=19, Name_kind=20, List_kind=21, Tuple_kind=22};
    193193struct _expr {
    194194        enum _expr_kind kind;
     
    227227               
    228228                struct {
     229                        asdl_seq *elts;
     230                } Set;
     231               
     232                struct {
    229233                        expr_ty elt;
    230234                        asdl_seq *generators;
    231235                } ListComp;
     236               
     237                struct {
     238                        expr_ty elt;
     239                        asdl_seq *generators;
     240                } SetComp;
     241               
     242                struct {
     243                        expr_ty key;
     244                        expr_ty value;
     245                        asdl_seq *generators;
     246                } DictComp;
    232247               
    233248                struct {
     
    450465expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int
    451466                 col_offset, PyArena *arena);
     467#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3)
     468expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena);
    452469#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4)
    453470expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int
    454471                     col_offset, PyArena *arena);
     472#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4)
     473expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int
     474                    col_offset, PyArena *arena);
     475#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5)
     476expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int
     477                     lineno, int col_offset, PyArena *arena);
    455478#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4)
    456479expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
  • python/vendor/current/Include/Python.h

    r2 r388  
    9393#include "rangeobject.h"
    9494#include "stringobject.h"
    95 /* #include "memoryobject.h" */
     95#include "memoryobject.h"
    9696#include "bufferobject.h"
    9797#include "bytesobject.h"
     
    108108#include "fileobject.h"
    109109#include "cobject.h"
     110#include "pycapsule.h"
    110111#include "traceback.h"
    111112#include "sliceobject.h"
     
    135136#include "eval.h"
    136137
     138#include "pyctype.h"
    137139#include "pystrtod.h"
    138140#include "pystrcmp.h"
     141#include "dtoa.h"
    139142
    140143/* _Py_Mangle is defined in compile.c */
     
    148151#define PyArg_NoArgs(v)         PyArg_Parse(v, "")
    149152
    150 /* Convert a possibly signed character to a nonnegative int */
    151 /* XXX This assumes characters are 8 bits wide */
    152 #ifdef __CHAR_UNSIGNED__
    153 #define Py_CHARMASK(c)          (c)
    154 #else
     153/* Argument must be a char or an int in [-128, 127] or [0, 255]. */
    155154#define Py_CHARMASK(c)          ((unsigned char)((c) & 0xff))
    156 #endif
    157155
    158156#include "pyfpe.h"
  • python/vendor/current/Include/abstract.h

    r2 r388  
    3333  If the programmer wants to get an item from another type of object
    3434  that provides sequence behavior, there is no clear way to do it
    35   correctly. 
     35  correctly.
    3636
    3737  The persistent programmer may peruse object.h and find that the
     
    4545  differ by the type of object being used.  Unfortunately, these
    4646  semantics are not clearly described in the current include files.
    47   An abstract interface providing more consistent semantics is needed. 
     47  An abstract interface providing more consistent semantics is needed.
    4848
    4949Proposal
     
    7878
    7979  From the point of view of Python accessing services provided by C
    80   modules: 
     80  modules:
    8181
    8282  - "Python module interface": this interface consist of the basic
     
    134134     int PyObject_Print(PyObject *o, FILE *fp, int flags);
    135135
    136          Print an object, o, on file, fp.  Returns -1 on
    137         error.  The flags argument is used to enable certain printing
    138          options. The only option currently supported is Py_Print_RAW.
    139 
    140          (What should be said about Py_Print_RAW?)     
     136     Print an object, o, on file, fp.  Returns -1 on
     137    error.  The flags argument is used to enable certain printing
     138     options. The only option currently supported is Py_Print_RAW.
     139
     140     (What should be said about Py_Print_RAW?)
    141141
    142142       */
     
    146146     int PyObject_HasAttrString(PyObject *o, char *attr_name);
    147147
    148          Returns 1 if o has the attribute attr_name, and 0 otherwise.
    149         This is equivalent to the Python expression:
    150          hasattr(o,attr_name).
    151 
    152         This function always succeeds.
     148     Returns 1 if o has the attribute attr_name, and 0 otherwise.
     149    This is equivalent to the Python expression:
     150     hasattr(o,attr_name).
     151
     152    This function always succeeds.
    153153
    154154       */
     
    158158     PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name);
    159159
    160         Retrieve an attributed named attr_name form object o.
    161         Returns the attribute value on success, or NULL on failure.
    162         This is the equivalent of the Python expression: o.attr_name.
     160    Retrieve an attributed named attr_name form object o.
     161    Returns the attribute value on success, or NULL on failure.
     162    This is the equivalent of the Python expression: o.attr_name.
    163163
    164164       */
     
    168168     int PyObject_HasAttr(PyObject *o, PyObject *attr_name);
    169169
    170          Returns 1 if o has the attribute attr_name, and 0 otherwise.
    171         This is equivalent to the Python expression:
    172          hasattr(o,attr_name).
    173 
    174         This function always succeeds.
     170     Returns 1 if o has the attribute attr_name, and 0 otherwise.
     171    This is equivalent to the Python expression:
     172     hasattr(o,attr_name).
     173
     174    This function always succeeds.
    175175
    176176       */
     
    180180     PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name);
    181181
    182         Retrieve an attributed named attr_name form object o.
    183         Returns the attribute value on success, or NULL on failure.
    184         This is the equivalent of the Python expression: o.attr_name.
     182    Retrieve an attributed named attr_name form object o.
     183    Returns the attribute value on success, or NULL on failure.
     184    This is the equivalent of the Python expression: o.attr_name.
    185185
    186186       */
     
    191191     int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v);
    192192
    193         Set the value of the attribute named attr_name, for object o,
    194         to the value, v. Returns -1 on failure.  This is
    195         the equivalent of the Python statement: o.attr_name=v.
     193    Set the value of the attribute named attr_name, for object o,
     194    to the value, v. Returns -1 on failure.  This is
     195    the equivalent of the Python statement: o.attr_name=v.
    196196
    197197       */
     
    201201     int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v);
    202202
    203         Set the value of the attribute named attr_name, for object o,
    204         to the value, v. Returns -1 on failure.  This is
    205         the equivalent of the Python statement: o.attr_name=v.
     203    Set the value of the attribute named attr_name, for object o,
     204    to the value, v. Returns -1 on failure.  This is
     205    the equivalent of the Python statement: o.attr_name=v.
    206206
    207207       */
     
    211211     int PyObject_DelAttrString(PyObject *o, char *attr_name);
    212212
    213         Delete attribute named attr_name, for object o. Returns
    214         -1 on failure.  This is the equivalent of the Python
    215         statement: del o.attr_name.
     213    Delete attribute named attr_name, for object o. Returns
     214    -1 on failure.  This is the equivalent of the Python
     215    statement: del o.attr_name.
    216216
    217217       */
     
    222222     int PyObject_DelAttr(PyObject *o, PyObject *attr_name);
    223223
    224         Delete attribute named attr_name, for object o. Returns -1
    225         on failure.  This is the equivalent of the Python
    226         statement: del o.attr_name.
     224    Delete attribute named attr_name, for object o. Returns -1
     225    on failure.  This is the equivalent of the Python
     226    statement: del o.attr_name.
    227227
    228228       */
     
    232232
    233233       /*
    234         Compare the values of o1 and o2 using a routine provided by
    235         o1, if one exists, otherwise with a routine provided by o2.
    236         The result of the comparison is returned in result.  Returns
    237         -1 on failure.  This is the equivalent of the Python
    238         statement: result=cmp(o1,o2).
     234    Compare the values of o1 and o2 using a routine provided by
     235    o1, if one exists, otherwise with a routine provided by o2.
     236    The result of the comparison is returned in result.  Returns
     237    -1 on failure.  This is the equivalent of the Python
     238    statement: result=cmp(o1,o2).
    239239
    240240       */
     
    244244     int PyObject_Compare(PyObject *o1, PyObject *o2);
    245245
    246         Compare the values of o1 and o2 using a routine provided by
    247         o1, if one exists, otherwise with a routine provided by o2.
    248         Returns the result of the comparison on success.  On error,
    249         the value returned is undefined. This is equivalent to the
    250         Python expression: cmp(o1,o2).
     246    Compare the values of o1 and o2 using a routine provided by
     247    o1, if one exists, otherwise with a routine provided by o2.
     248    Returns the result of the comparison on success.  On error,
     249    the value returned is undefined. This is equivalent to the
     250    Python expression: cmp(o1,o2).
    251251
    252252       */
     
    256256     PyObject *PyObject_Repr(PyObject *o);
    257257
    258         Compute the string representation of object, o.  Returns the
    259         string representation on success, NULL on failure.  This is
    260         the equivalent of the Python expression: repr(o).
    261 
    262         Called by the repr() built-in function and by reverse quotes.
     258    Compute the string representation of object, o.  Returns the
     259    string representation on success, NULL on failure.  This is
     260    the equivalent of the Python expression: repr(o).
     261
     262    Called by the repr() built-in function and by reverse quotes.
    263263
    264264       */
     
    268268     PyObject *PyObject_Str(PyObject *o);
    269269
    270         Compute the string representation of object, o.  Returns the
    271         string representation on success, NULL on failure.  This is
    272         the equivalent of the Python expression: str(o).)
    273 
    274         Called by the str() built-in function and by the print
    275         statement.
     270    Compute the string representation of object, o.  Returns the
     271    string representation on success, NULL on failure.  This is
     272    the equivalent of the Python expression: str(o).)
     273
     274    Called by the str() built-in function and by the print
     275    statement.
    276276
    277277       */
     
    281281     PyObject *PyObject_Unicode(PyObject *o);
    282282
    283         Compute the unicode representation of object, o.  Returns the
    284         unicode representation on success, NULL on failure.  This is
    285         the equivalent of the Python expression: unistr(o).)
    286 
    287         Called by the unistr() built-in function.
     283    Compute the unicode representation of object, o.  Returns the
     284    unicode representation on success, NULL on failure.  This is
     285    the equivalent of the Python expression: unistr(o).)
     286
     287    Called by the unistr() built-in function.
    288288
    289289       */
     
    293293     PyAPI_FUNC(int) PyCallable_Check(PyObject *o);
    294294
    295         Determine if the object, o, is callable.  Return 1 if the
    296         object is callable and 0 otherwise.
    297 
    298         This function always succeeds.
     295    Determine if the object, o, is callable.  Return 1 if the
     296    object is callable and 0 otherwise.
     297
     298    This function always succeeds.
    299299
    300300       */
     
    303303
    304304     PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
    305                                         PyObject *args, PyObject *kw);
    306 
    307        /*
    308         Call a callable Python object, callable_object, with
    309         arguments and keywords arguments.  The 'args' argument can not be
    310         NULL, but the 'kw' argument can be NULL.
    311 
    312        */
    313      
     305                                        PyObject *args, PyObject *kw);
     306
     307       /*
     308    Call a callable Python object, callable_object, with
     309    arguments and keywords arguments.  The 'args' argument can not be
     310    NULL, but the 'kw' argument can be NULL.
     311
     312       */
     313
    314314     PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object,
    315315                                               PyObject *args);
    316316
    317317       /*
    318         Call a callable Python object, callable_object, with
    319         arguments given by the tuple, args.  If no arguments are
    320         needed, then args may be NULL.  Returns the result of the
    321         call on success, or NULL on failure.  This is the equivalent
    322         of the Python expression: apply(o,args).
     318    Call a callable Python object, callable_object, with
     319    arguments given by the tuple, args.  If no arguments are
     320    needed, then args may be NULL.  Returns the result of the
     321    call on success, or NULL on failure.  This is the equivalent
     322    of the Python expression: apply(o,args).
    323323
    324324       */
     
    328328
    329329       /*
    330         Call a callable Python object, callable_object, with a
    331         variable number of C arguments. The C arguments are described
    332         using a mkvalue-style format string. The format may be NULL,
    333         indicating that no arguments are provided.  Returns the
    334         result of the call on success, or NULL on failure.  This is
    335         the equivalent of the Python expression: apply(o,args).
     330    Call a callable Python object, callable_object, with a
     331    variable number of C arguments. The C arguments are described
     332    using a mkvalue-style format string. The format may be NULL,
     333    indicating that no arguments are provided.  Returns the
     334    result of the call on success, or NULL on failure.  This is
     335    the equivalent of the Python expression: apply(o,args).
    336336
    337337       */
     
    342342
    343343       /*
    344         Call the method named m of object o with a variable number of
    345         C arguments.  The C arguments are described by a mkvalue
    346         format string.  The format may be NULL, indicating that no
    347         arguments are provided. Returns the result of the call on
    348         success, or NULL on failure.  This is the equivalent of the
    349         Python expression: o.method(args).
     344    Call the method named m of object o with a variable number of
     345    C arguments.  The C arguments are described by a mkvalue
     346    format string.  The format may be NULL, indicating that no
     347    arguments are provided. Returns the result of the call on
     348    success, or NULL on failure.  This is the equivalent of the
     349    Python expression: o.method(args).
    350350       */
    351351
    352352     PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
    353                                                         char *format, ...);
     353                                                        char *format, ...);
    354354     PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o,
    355                                                        char *name,
    356                                                        char *format, ...);
     355                                                       char *name,
     356                                                       char *format, ...);
    357357
    358358     PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
     
    360360
    361361       /*
    362         Call a callable Python object, callable_object, with a
    363         variable number of C arguments.  The C arguments are provided
    364         as PyObject * values, terminated by a NULL.  Returns the
    365         result of the call on success, or NULL on failure.  This is
    366         the equivalent of the Python expression: apply(o,args).
     362    Call a callable Python object, callable_object, with a
     363    variable number of C arguments.  The C arguments are provided
     364    as PyObject * values, terminated by a NULL.  Returns the
     365    result of the call on success, or NULL on failure.  This is
     366    the equivalent of the Python expression: apply(o,args).
    367367       */
    368368
     
    372372
    373373       /*
    374         Call the method named m of object o with a variable number of
    375         C arguments.  The C arguments are provided as PyObject *
    376         values, terminated by NULL.  Returns the result of the call
    377         on success, or NULL on failure.  This is the equivalent of
    378         the Python expression: o.method(args).
     374    Call the method named m of object o with a variable number of
     375    C arguments.  The C arguments are provided as PyObject *
     376    values, terminated by NULL.  Returns the result of the call
     377    on success, or NULL on failure.  This is the equivalent of
     378    the Python expression: o.method(args).
    379379       */
    380380
     
    384384     long PyObject_Hash(PyObject *o);
    385385
    386          Compute and return the hash, hash_value, of an object, o.  On
    387         failure, return -1.  This is the equivalent of the Python
    388         expression: hash(o).
     386     Compute and return the hash, hash_value, of an object, o.  On
     387    failure, return -1.  This is the equivalent of the Python
     388    expression: hash(o).
    389389
    390390       */
     
    395395     int PyObject_IsTrue(PyObject *o);
    396396
    397         Returns 1 if the object, o, is considered to be true, 0 if o is
    398         considered to be false and -1 on failure. This is equivalent to the
    399         Python expression: not not o
     397    Returns 1 if the object, o, is considered to be true, 0 if o is
     398    considered to be false and -1 on failure. This is equivalent to the
     399    Python expression: not not o
    400400
    401401       */
     
    405405     int PyObject_Not(PyObject *o);
    406406
    407         Returns 0 if the object, o, is considered to be true, 1 if o is
    408         considered to be false and -1 on failure. This is equivalent to the
    409         Python expression: not o
     407    Returns 0 if the object, o, is considered to be true, 1 if o is
     408    considered to be false and -1 on failure. This is equivalent to the
     409    Python expression: not o
    410410
    411411       */
     
    414414
    415415       /*
    416         On success, returns a type object corresponding to the object
    417         type of object o. On failure, returns NULL.  This is
    418         equivalent to the Python expression: type(o).
     416    On success, returns a type object corresponding to the object
     417    type of object o. On failure, returns NULL.  This is
     418    equivalent to the Python expression: type(o).
    419419       */
    420420
     
    422422
    423423       /*
    424          Return the size of object o.  If the object, o, provides
    425         both sequence and mapping protocols, the sequence size is
    426         returned. On error, -1 is returned.  This is the equivalent
    427         to the Python expression: len(o).
     424     Return the size of object o.  If the object, o, provides
     425    both sequence and mapping protocols, the sequence size is
     426    returned. On error, -1 is returned.  This is the equivalent
     427    to the Python expression: len(o).
    428428
    429429       */
     
    437437
    438438       /*
    439          Guess the size of object o using len(o) or o.__length_hint__().
    440          If neither of those return a non-negative value, then return the
    441          default value.  If one of the calls fails, this function returns -1.
     439     Guess the size of object o using len(o) or o.__length_hint__().
     440     If neither of those return a non-negative value, then return the
     441     default value.  If one of the calls fails, this function returns -1.
    442442       */
    443443
     
    445445
    446446       /*
    447         Return element of o corresponding to the object, key, or NULL
    448         on failure. This is the equivalent of the Python expression:
    449         o[key].
     447    Return element of o corresponding to the object, key, or NULL
     448    on failure. This is the equivalent of the Python expression:
     449    o[key].
    450450
    451451       */
     
    454454
    455455       /*
    456         Map the object, key, to the value, v.  Returns
    457         -1 on failure.  This is the equivalent of the Python
    458         statement: o[key]=v.
     456    Map the object, key, to the value, v.  Returns
     457    -1 on failure.  This is the equivalent of the Python
     458    statement: o[key]=v.
    459459       */
    460460
     
    462462
    463463       /*
    464          Remove the mapping for object, key, from the object *o.
    465          Returns -1 on failure.  This is equivalent to
    466          the Python statement: del o[key].
     464     Remove the mapping for object, key, from the object *o.
     465     Returns -1 on failure.  This is equivalent to
     466     the Python statement: del o[key].
    467467       */
    468468
     
    470470
    471471       /*
    472         Delete the mapping for key from *o.  Returns -1 on failure.
    473         This is the equivalent of the Python statement: del o[key].
     472    Delete the mapping for key from *o.  Returns -1 on failure.
     473    This is the equivalent of the Python statement: del o[key].
    474474       */
    475475
    476476     PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj,
    477                                           const char **buffer,
    478                                           Py_ssize_t *buffer_len);
    479 
    480        /* 
    481           Takes an arbitrary object which must support the (character,
    482           single segment) buffer interface and returns a pointer to a
    483           read-only memory location useable as character based input
    484           for subsequent processing.
    485 
    486           0 is returned on success.  buffer and buffer_len are only
    487           set in case no error occurs. Otherwise, -1 is returned and
    488           an exception set.
     477                                          const char **buffer,
     478                                          Py_ssize_t *buffer_len);
     479
     480       /*
     481      Takes an arbitrary object which must support the (character,
     482      single segment) buffer interface and returns a pointer to a
     483      read-only memory location useable as character based input
     484      for subsequent processing.
     485
     486      0 is returned on success.  buffer and buffer_len are only
     487      set in case no error occurs. Otherwise, -1 is returned and
     488      an exception set.
    489489
    490490       */
     
    492492     PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
    493493
    494       /* 
    495           Checks whether an arbitrary object supports the (character,
    496           single segment) buffer interface.  Returns 1 on success, 0
    497           on failure.
     494      /*
     495      Checks whether an arbitrary object supports the (character,
     496      single segment) buffer interface.  Returns 1 on success, 0
     497      on failure.
    498498
    499499      */
    500500
    501501     PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
    502                                           const void **buffer,
    503                                           Py_ssize_t *buffer_len);
    504 
    505        /* 
    506           Same as PyObject_AsCharBuffer() except that this API expects
    507           (readable, single segment) buffer interface and returns a
    508           pointer to a read-only memory location which can contain
    509           arbitrary data.
    510 
    511           0 is returned on success.  buffer and buffer_len are only
    512           set in case no error occurrs.  Otherwise, -1 is returned and
    513           an exception set.
     502                                          const void **buffer,
     503                                          Py_ssize_t *buffer_len);
     504
     505       /*
     506      Same as PyObject_AsCharBuffer() except that this API expects
     507      (readable, single segment) buffer interface and returns a
     508      pointer to a read-only memory location which can contain
     509      arbitrary data.
     510
     511      0 is returned on success.  buffer and buffer_len are only
     512      set in case no error occurs.  Otherwise, -1 is returned and
     513      an exception set.
    514514
    515515       */
    516516
    517517     PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
    518                                            void **buffer,
    519                                            Py_ssize_t *buffer_len);
    520 
    521        /* 
    522           Takes an arbitrary object which must support the (writeable,
    523           single segment) buffer interface and returns a pointer to a
    524           writeable memory location in buffer of size buffer_len.
    525 
    526           0 is returned on success.  buffer and buffer_len are only
    527           set in case no error occurrs. Otherwise, -1 is returned and
    528           an exception set.
    529 
    530        */
    531 
    532         /* new buffer API */
     518                                           void **buffer,
     519                                           Py_ssize_t *buffer_len);
     520
     521       /*
     522      Takes an arbitrary object which must support the (writeable,
     523      single segment) buffer interface and returns a pointer to a
     524      writeable memory location in buffer of size buffer_len.
     525
     526      0 is returned on success.  buffer and buffer_len are only
     527      set in case no error occurs. Otherwise, -1 is returned and
     528      an exception set.
     529
     530       */
     531
     532    /* new buffer API */
    533533
    534534#define PyObject_CheckBuffer(obj) \
    535         (((obj)->ob_type->tp_as_buffer != NULL) &&                      \
    536         (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_NEWBUFFER)) && \
    537         ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
    538                            
    539         /* Return 1 if the getbuffer function is available, otherwise
    540            return 0 */
    541 
    542      PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, 
    543                                         int flags);
    544 
    545         /* This is a C-API version of the getbuffer function call.  It checks
    546            to make sure object has the required function pointer and issues the
    547            call.  Returns -1 and raises an error on failure and returns 0 on
    548            success
    549         */
     535    (((obj)->ob_type->tp_as_buffer != NULL) &&                          \
     536    (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_NEWBUFFER)) && \
     537    ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
     538
     539    /* Return 1 if the getbuffer function is available, otherwise
     540       return 0 */
     541
     542     PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view,
     543                                        int flags);
     544
     545    /* This is a C-API version of the getbuffer function call.  It checks
     546       to make sure object has the required function pointer and issues the
     547       call.  Returns -1 and raises an error on failure and returns 0 on
     548       success
     549    */
    550550
    551551
    552552     PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices);
    553        
    554         /* Get the memory area pointed to by the indices for the buffer given.
    555            Note that view->ndim is the assumed size of indices
    556         */
     553
     554    /* Get the memory area pointed to by the indices for the buffer given.
     555       Note that view->ndim is the assumed size of indices
     556    */
    557557
    558558     PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *);
    559                
    560         /* Return the implied itemsize of the data-format area from a
    561            struct-style description */
    562    
    563 
    564        
     559
     560    /* Return the implied itemsize of the data-format area from a
     561       struct-style description */
     562
     563
     564
    565565     PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view,
    566                                            Py_ssize_t len, char fort);
    567 
    568      PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, 
    569                                              Py_ssize_t len, char fort);
    570 
    571 
    572         /* Copy len bytes of data from the contiguous chunk of memory
    573            pointed to by buf into the buffer exported by obj.  Return
    574            0 on success and return -1 and raise a PyBuffer_Error on
    575            error (i.e. the object does not have a buffer interface or
    576            it is not working).
    577 
    578            If fort is 'F' and the object is multi-dimensional,
    579            then the data will be copied into the array in
    580            Fortran-style (first dimension varies the fastest).  If
    581            fort is 'C', then the data will be copied into the array
    582            in C-style (last dimension varies the fastest).  If fort
    583            is 'A', then it does not matter and the copy will be made
    584            in whatever way is more efficient.
    585 
    586         */
     566                                           Py_ssize_t len, char fort);
     567
     568     PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf,
     569                                             Py_ssize_t len, char fort);
     570
     571
     572    /* Copy len bytes of data from the contiguous chunk of memory
     573       pointed to by buf into the buffer exported by obj.  Return
     574       0 on success and return -1 and raise a PyBuffer_Error on
     575       error (i.e. the object does not have a buffer interface or
     576       it is not working).
     577
     578       If fort is 'F' and the object is multi-dimensional,
     579       then the data will be copied into the array in
     580       Fortran-style (first dimension varies the fastest).  If
     581       fort is 'C', then the data will be copied into the array
     582       in C-style (last dimension varies the fastest).  If fort
     583       is 'A', then it does not matter and the copy will be made
     584       in whatever way is more efficient.
     585
     586    */
    587587
    588588     PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src);
    589        
    590         /* Copy the data from the src buffer to the buffer of destination
    591          */
     589
     590    /* Copy the data from the src buffer to the buffer of destination
     591     */
    592592
    593593     PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort);
    594594
    595595
    596      PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, 
    597                                                     Py_ssize_t *shape,
    598                                                     Py_ssize_t *strides,
    599                                                     int itemsize,
    600                                                     char fort);
    601 
    602         /*  Fill the strides array with byte-strides of a contiguous
    603             (Fortran-style if fort is 'F' or C-style otherwise)
    604             array of the given shape with the given number of bytes
    605             per element.
    606         */
     596     PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
     597                                                    Py_ssize_t *shape,
     598                                                    Py_ssize_t *strides,
     599                                                    int itemsize,
     600                                                    char fort);
     601
     602    /*  Fill the strides array with byte-strides of a contiguous
     603        (Fortran-style if fort is 'F' or C-style otherwise)
     604        array of the given shape with the given number of bytes
     605        per element.
     606    */
    607607
    608608     PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf,
    609                                        Py_ssize_t len, int readonly,
    610                                        int flags);
    611 
    612         /* Fills in a buffer-info structure correctly for an exporter
    613            that can only share a contiguous chunk of memory of
    614            "unsigned bytes" of the given length. Returns 0 on success
    615            and -1 (with raising an error) on error.
    616          */
     609                                       Py_ssize_t len, int readonly,
     610                                       int flags);
     611
     612    /* Fills in a buffer-info structure correctly for an exporter
     613       that can only share a contiguous chunk of memory of
     614       "unsigned bytes" of the given length. Returns 0 on success
     615       and -1 (with raising an error) on error.
     616     */
    617617
    618618     PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view);
    619619
    620620       /* Releases a Py_buffer obtained from getbuffer ParseTuple's s*.
    621         */
     621    */
    622622
    623623     PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj,
    624                                             PyObject *format_spec);
    625        /*
    626         Takes an arbitrary object and returns the result of
    627         calling obj.__format__(format_spec).
     624                                            PyObject *format_spec);
     625       /*
     626    Takes an arbitrary object and returns the result of
     627    calling obj.__format__(format_spec).
    628628       */
    629629
     
    632632     PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
    633633     /* Takes an object and returns an iterator for it.
    634         This is typically a new iterator but if the argument
    635         is an iterator, this returns itself. */
     634    This is typically a new iterator but if the argument
     635    is an iterator, this returns itself. */
    636636
    637637#define PyIter_Check(obj) \
    638638    (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_ITER) && \
    639      (obj)->ob_type->tp_iternext != NULL)
     639     (obj)->ob_type->tp_iternext != NULL && \
     640     (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
    640641
    641642     PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
    642643     /* Takes an iterator object and calls its tp_iternext slot,
    643         returning the next value.  If the iterator is exhausted,
    644         this returns NULL without setting an exception.
    645         NULL with an exception means an error occurred. */
     644    returning the next value.  If the iterator is exhausted,
     645    this returns NULL without setting an exception.
     646    NULL with an exception means an error occurred. */
    646647
    647648/*  Number Protocol:*/
     
    650651
    651652       /*
    652          Returns 1 if the object, o, provides numeric protocols, and
    653          false otherwise.
    654 
    655         This function always succeeds.
     653     Returns 1 if the object, o, provides numeric protocols, and
     654     false otherwise.
     655
     656    This function always succeeds.
    656657
    657658       */
     
    660661
    661662       /*
    662         Returns the result of adding o1 and o2, or null on failure.
    663         This is the equivalent of the Python expression: o1+o2.
     663    Returns the result of adding o1 and o2, or null on failure.
     664    This is the equivalent of the Python expression: o1+o2.
    664665
    665666
     
    669670
    670671       /*
    671         Returns the result of subtracting o2 from o1, or null on
    672         failure.  This is the equivalent of the Python expression:
    673         o1-o2.
     672    Returns the result of subtracting o2 from o1, or null on
     673    failure.  This is the equivalent of the Python expression:
     674    o1-o2.
    674675
    675676       */
     
    678679
    679680       /*
    680         Returns the result of multiplying o1 and o2, or null on
    681         failure.  This is the equivalent of the Python expression:
    682         o1*o2.
     681    Returns the result of multiplying o1 and o2, or null on
     682    failure.  This is the equivalent of the Python expression:
     683    o1*o2.
    683684
    684685
     
    688689
    689690       /*
    690         Returns the result of dividing o1 by o2, or null on failure.
    691         This is the equivalent of the Python expression: o1/o2.
     691    Returns the result of dividing o1 by o2, or null on failure.
     692    This is the equivalent of the Python expression: o1/o2.
    692693
    693694
     
    697698
    698699       /*
    699         Returns the result of dividing o1 by o2 giving an integral result,
    700         or null on failure.
    701         This is the equivalent of the Python expression: o1//o2.
     700    Returns the result of dividing o1 by o2 giving an integral result,
     701    or null on failure.
     702    This is the equivalent of the Python expression: o1//o2.
    702703
    703704
     
    707708
    708709       /*
    709         Returns the result of dividing o1 by o2 giving a float result,
    710         or null on failure.
    711         This is the equivalent of the Python expression: o1/o2.
     710    Returns the result of dividing o1 by o2 giving a float result,
     711    or null on failure.
     712    This is the equivalent of the Python expression: o1/o2.
    712713
    713714
     
    717718
    718719       /*
    719         Returns the remainder of dividing o1 by o2, or null on
    720         failure.  This is the equivalent of the Python expression:
    721         o1%o2.
     720    Returns the remainder of dividing o1 by o2, or null on
     721    failure.  This is the equivalent of the Python expression:
     722    o1%o2.
    722723
    723724
     
    727728
    728729       /*
    729         See the built-in function divmod.  Returns NULL on failure.
    730         This is the equivalent of the Python expression:
    731         divmod(o1,o2).
     730    See the built-in function divmod.  Returns NULL on failure.
     731    This is the equivalent of the Python expression:
     732    divmod(o1,o2).
    732733
    733734
     
    738739
    739740       /*
    740         See the built-in function pow.  Returns NULL on failure.
    741         This is the equivalent of the Python expression:
    742         pow(o1,o2,o3), where o3 is optional.
     741    See the built-in function pow.  Returns NULL on failure.
     742    This is the equivalent of the Python expression:
     743    pow(o1,o2,o3), where o3 is optional.
    743744
    744745       */
     
    747748
    748749       /*
    749         Returns the negation of o on success, or null on failure.
    750         This is the equivalent of the Python expression: -o.
     750    Returns the negation of o on success, or null on failure.
     751    This is the equivalent of the Python expression: -o.
    751752
    752753       */
     
    755756
    756757       /*
    757          Returns the (what?) of o on success, or NULL on failure.
    758         This is the equivalent of the Python expression: +o.
     758     Returns the (what?) of o on success, or NULL on failure.
     759    This is the equivalent of the Python expression: +o.
    759760
    760761       */
     
    763764
    764765       /*
    765         Returns the absolute value of o, or null on failure.  This is
    766         the equivalent of the Python expression: abs(o).
     766    Returns the absolute value of o, or null on failure.  This is
     767    the equivalent of the Python expression: abs(o).
    767768
    768769       */
     
    771772
    772773       /*
    773         Returns the bitwise negation of o on success, or NULL on
    774         failure.  This is the equivalent of the Python expression:
    775         ~o.
     774    Returns the bitwise negation of o on success, or NULL on
     775    failure.  This is the equivalent of the Python expression:
     776    ~o.
    776777
    777778
     
    781782
    782783       /*
    783         Returns the result of left shifting o1 by o2 on success, or
    784         NULL on failure.  This is the equivalent of the Python
    785         expression: o1 << o2.
     784    Returns the result of left shifting o1 by o2 on success, or
     785    NULL on failure.  This is the equivalent of the Python
     786    expression: o1 << o2.
    786787
    787788
     
    791792
    792793       /*
    793         Returns the result of right shifting o1 by o2 on success, or
    794         NULL on failure.  This is the equivalent of the Python
    795         expression: o1 >> o2.
     794    Returns the result of right shifting o1 by o2 on success, or
     795    NULL on failure.  This is the equivalent of the Python
     796    expression: o1 >> o2.
    796797
    797798       */
     
    800801
    801802       /*
    802         Returns the result of bitwise and of o1 and o2 on success, or
    803         NULL on failure. This is the equivalent of the Python
    804         expression: o1&o2.
     803    Returns the result of bitwise and of o1 and o2 on success, or
     804    NULL on failure. This is the equivalent of the Python
     805    expression: o1&o2.
    805806
    806807
     
    810811
    811812       /*
    812         Returns the bitwise exclusive or of o1 by o2 on success, or
    813         NULL on failure.  This is the equivalent of the Python
    814         expression: o1^o2.
     813    Returns the bitwise exclusive or of o1 by o2 on success, or
     814    NULL on failure.  This is the equivalent of the Python
     815    expression: o1^o2.
    815816
    816817
     
    820821
    821822       /*
    822         Returns the result of bitwise or on o1 and o2 on success, or
    823         NULL on failure.  This is the equivalent of the Python
    824         expression: o1|o2.
     823    Returns the result of bitwise or on o1 and o2 on success, or
     824    NULL on failure.  This is the equivalent of the Python
     825    expression: o1|o2.
    825826
    826827       */
     
    830831     int PyNumber_Coerce(PyObject **p1, PyObject **p2);
    831832
    832         This function takes the addresses of two variables of type
    833         PyObject*.
    834 
    835         If the objects pointed to by *p1 and *p2 have the same type,
    836         increment their reference count and return 0 (success).
    837         If the objects can be converted to a common numeric type,
    838         replace *p1 and *p2 by their converted value (with 'new'
    839         reference counts), and return 0.
    840         If no conversion is possible, or if some other error occurs,
    841         return -1 (failure) and don't increment the reference counts.
    842         The call PyNumber_Coerce(&o1, &o2) is equivalent to the Python
    843         statement o1, o2 = coerce(o1, o2).
     833    This function takes the addresses of two variables of type
     834    PyObject*.
     835
     836    If the objects pointed to by *p1 and *p2 have the same type,
     837    increment their reference count and return 0 (success).
     838    If the objects can be converted to a common numeric type,
     839    replace *p1 and *p2 by their converted value (with 'new'
     840    reference counts), and return 0.
     841    If no conversion is possible, or if some other error occurs,
     842    return -1 (failure) and don't increment the reference counts.
     843    The call PyNumber_Coerce(&o1, &o2) is equivalent to the Python
     844    statement o1, o2 = coerce(o1, o2).
    844845
    845846       */
     
    849850    PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_INDEX) && \
    850851    (obj)->ob_type->tp_as_number->nb_index != NULL)
    851        
     852
    852853     PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o);
    853854
    854855       /*
    855         Returns the object converted to a Python long or int
    856         or NULL with an error raised on failure.
     856    Returns the object converted to a Python long or int
     857    or NULL with an error raised on failure.
    857858       */
    858859
     
    860861
    861862       /*
    862          Returns the Integral instance converted to an int. The
    863          instance is expected to be int or long or have an __int__
    864          method. Steals integral's reference. error_format will be
    865          used to create the TypeError if integral isn't actually an
    866          Integral instance. error_format should be a format string
    867          that can accept a char* naming integral's type.
     863     Returns the Integral instance converted to an int. The
     864     instance is expected to be int or long or have an __int__
     865     method. Steals integral's reference. error_format will be
     866     used to create the TypeError if integral isn't actually an
     867     Integral instance. error_format should be a format string
     868     that can accept a char* naming integral's type.
    868869       */
    869870
    870871     PyAPI_FUNC(PyObject *) _PyNumber_ConvertIntegralToInt(
    871              PyObject *integral,
    872              const char* error_format);
    873 
    874        /*
    875         Returns the object converted to Py_ssize_t by going through
    876         PyNumber_Index first.  If an overflow error occurs while
    877         converting the int-or-long to Py_ssize_t, then the second argument
    878         is the error-type to return.  If it is NULL, then the overflow error
    879         is cleared and the value is clipped.
     872         PyObject *integral,
     873         const char* error_format);
     874
     875       /*
     876    Returns the object converted to Py_ssize_t by going through
     877    PyNumber_Index first.  If an overflow error occurs while
     878    converting the int-or-long to Py_ssize_t, then the second argument
     879    is the error-type to return.  If it is NULL, then the overflow error
     880    is cleared and the value is clipped.
    880881       */
    881882
     
    883884
    884885       /*
    885         Returns the o converted to an integer object on success, or
    886         NULL on failure.  This is the equivalent of the Python
    887         expression: int(o).
     886    Returns the o converted to an integer object on success, or
     887    NULL on failure.  This is the equivalent of the Python
     888    expression: int(o).
    888889
    889890       */
     
    892893
    893894       /*
    894         Returns the o converted to a long integer object on success,
    895         or NULL on failure.  This is the equivalent of the Python
    896         expression: long(o).
     895    Returns the o converted to a long integer object on success,
     896    or NULL on failure.  This is the equivalent of the Python
     897    expression: long(o).
    897898
    898899       */
     
    901902
    902903       /*
    903         Returns the o converted to a float object on success, or NULL
    904         on failure.  This is the equivalent of the Python expression:
    905         float(o).
    906        */
    907          
     904    Returns the o converted to a float object on success, or NULL
     905    on failure.  This is the equivalent of the Python expression:
     906    float(o).
     907       */
     908
    908909/*  In-place variants of (some of) the above number protocol functions */
    909910
     
    911912
    912913       /*
    913         Returns the result of adding o2 to o1, possibly in-place, or null
    914         on failure.  This is the equivalent of the Python expression:
    915         o1 += o2.
     914    Returns the result of adding o2 to o1, possibly in-place, or null
     915    on failure.  This is the equivalent of the Python expression:
     916    o1 += o2.
    916917
    917918       */
     
    920921
    921922       /*
    922         Returns the result of subtracting o2 from o1, possibly in-place or
    923         null on failure.  This is the equivalent of the Python expression:
    924         o1 -= o2.
     923    Returns the result of subtracting o2 from o1, possibly in-place or
     924    null on failure.  This is the equivalent of the Python expression:
     925    o1 -= o2.
    925926
    926927       */
     
    929930
    930931       /*
    931         Returns the result of multiplying o1 by o2, possibly in-place, or
    932         null on failure.  This is the equivalent of the Python expression:
    933         o1 *= o2.
     932    Returns the result of multiplying o1 by o2, possibly in-place, or
     933    null on failure.  This is the equivalent of the Python expression:
     934    o1 *= o2.
    934935
    935936       */
     
    938939
    939940       /*
    940         Returns the result of dividing o1 by o2, possibly in-place, or null
    941         on failure.  This is the equivalent of the Python expression:
    942         o1 /= o2.
     941    Returns the result of dividing o1 by o2, possibly in-place, or null
     942    on failure.  This is the equivalent of the Python expression:
     943    o1 /= o2.
    943944
    944945       */
    945946
    946947     PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1,
    947                                                        PyObject *o2);
    948 
    949        /*
    950         Returns the result of dividing o1 by o2 giving an integral result,
    951         possibly in-place, or null on failure.
    952         This is the equivalent of the Python expression:
    953         o1 /= o2.
     948                                                       PyObject *o2);
     949
     950       /*
     951    Returns the result of dividing o1 by o2 giving an integral result,
     952    possibly in-place, or null on failure.
     953    This is the equivalent of the Python expression:
     954    o1 /= o2.
    954955
    955956       */
    956957
    957958     PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1,
    958                                                       PyObject *o2);
    959 
    960        /*
    961         Returns the result of dividing o1 by o2 giving a float result,
    962         possibly in-place, or null on failure.
    963         This is the equivalent of the Python expression:
    964         o1 /= o2.
     959                                                      PyObject *o2);
     960
     961       /*
     962    Returns the result of dividing o1 by o2 giving a float result,
     963    possibly in-place, or null on failure.
     964    This is the equivalent of the Python expression:
     965    o1 /= o2.
    965966
    966967       */
     
    969970
    970971       /*
    971         Returns the remainder of dividing o1 by o2, possibly in-place, or
    972         null on failure.  This is the equivalent of the Python expression:
    973         o1 %= o2.
     972    Returns the remainder of dividing o1 by o2, possibly in-place, or
     973    null on failure.  This is the equivalent of the Python expression:
     974    o1 %= o2.
    974975
    975976       */
    976977
    977978     PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2,
    978                                                  PyObject *o3);
    979 
    980        /*
    981         Returns the result of raising o1 to the power of o2, possibly
    982         in-place, or null on failure.  This is the equivalent of the Python
    983         expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present.
     979                                                 PyObject *o3);
     980
     981       /*
     982    Returns the result of raising o1 to the power of o2, possibly
     983    in-place, or null on failure.  This is the equivalent of the Python
     984    expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present.
    984985
    985986       */
     
    988989
    989990       /*
    990         Returns the result of left shifting o1 by o2, possibly in-place, or
    991         null on failure.  This is the equivalent of the Python expression:
    992         o1 <<= o2.
     991    Returns the result of left shifting o1 by o2, possibly in-place, or
     992    null on failure.  This is the equivalent of the Python expression:
     993    o1 <<= o2.
    993994
    994995       */
     
    997998
    998999       /*
    999         Returns the result of right shifting o1 by o2, possibly in-place or
    1000         null on failure.  This is the equivalent of the Python expression:
    1001         o1 >>= o2.
     1000    Returns the result of right shifting o1 by o2, possibly in-place or
     1001    null on failure.  This is the equivalent of the Python expression:
     1002    o1 >>= o2.
    10021003
    10031004       */
     
    10061007
    10071008       /*
    1008         Returns the result of bitwise and of o1 and o2, possibly in-place,
    1009         or null on failure. This is the equivalent of the Python
    1010         expression: o1 &= o2.
     1009    Returns the result of bitwise and of o1 and o2, possibly in-place,
     1010    or null on failure. This is the equivalent of the Python
     1011    expression: o1 &= o2.
    10111012
    10121013       */
     
    10151016
    10161017       /*
    1017         Returns the bitwise exclusive or of o1 by o2, possibly in-place, or
    1018         null on failure.  This is the equivalent of the Python expression:
    1019         o1 ^= o2.
     1018    Returns the bitwise exclusive or of o1 by o2, possibly in-place, or
     1019    null on failure.  This is the equivalent of the Python expression:
     1020    o1 ^= o2.
    10201021
    10211022       */
     
    10241025
    10251026       /*
    1026         Returns the result of bitwise or of o1 and o2, possibly in-place,
    1027         or null on failure.  This is the equivalent of the Python
    1028         expression: o1 |= o2.
     1027    Returns the result of bitwise or of o1 and o2, possibly in-place,
     1028    or null on failure.  This is the equivalent of the Python
     1029    expression: o1 |= o2.
    10291030
    10301031       */
     
    10341035
    10351036       /*
    1036         Returns the integer n converted to a string with a base, with a base
    1037         marker of 0b, 0o or 0x prefixed if applicable.
    1038         If n is not an int object, it is converted with PyNumber_Index first.
     1037    Returns the integer n converted to a string with a base, with a base
     1038    marker of 0b, 0o or 0x prefixed if applicable.
     1039    If n is not an int object, it is converted with PyNumber_Index first.
    10391040       */
    10401041
     
    10451046
    10461047       /*
    1047          Return 1 if the object provides sequence protocol, and zero
    1048          otherwise. 
    1049 
    1050         This function always succeeds.
     1048     Return 1 if the object provides sequence protocol, and zero
     1049     otherwise.
     1050
     1051    This function always succeeds.
    10511052
    10521053       */
     
    10551056
    10561057       /*
    1057          Return the size of sequence object o, or -1 on failure.
     1058     Return the size of sequence object o, or -1 on failure.
    10581059
    10591060       */
     
    10681069
    10691070       /*
    1070         Return the concatenation of o1 and o2 on success, and NULL on
    1071         failure.   This is the equivalent of the Python
    1072         expression: o1+o2.
     1071    Return the concatenation of o1 and o2 on success, and NULL on
     1072    failure.   This is the equivalent of the Python
     1073    expression: o1+o2.
    10731074
    10741075       */
     
    10771078
    10781079       /*
    1079         Return the result of repeating sequence object o count times,
    1080         or NULL on failure.  This is the equivalent of the Python
    1081         expression: o1*count.
     1080    Return the result of repeating sequence object o count times,
     1081    or NULL on failure.  This is the equivalent of the Python
     1082    expression: o1*count.
    10821083
    10831084       */
     
    10861087
    10871088       /*
    1088         Return the ith element of o, or NULL on failure. This is the
    1089         equivalent of the Python expression: o[i].
     1089    Return the ith element of o, or NULL on failure. This is the
     1090    equivalent of the Python expression: o[i].
    10901091       */
    10911092
     
    10931094
    10941095       /*
    1095         Return the slice of sequence object o between i1 and i2, or
    1096         NULL on failure. This is the equivalent of the Python
    1097         expression: o[i1:i2].
     1096    Return the slice of sequence object o between i1 and i2, or
     1097    NULL on failure. This is the equivalent of the Python
     1098    expression: o[i1:i2].
    10981099
    10991100       */
     
    11021103
    11031104       /*
    1104         Assign object v to the ith element of o.  Returns
    1105         -1 on failure.  This is the equivalent of the Python
    1106         statement: o[i]=v.
     1105    Assign object v to the ith element of o.  Returns
     1106    -1 on failure.  This is the equivalent of the Python
     1107    statement: o[i]=v.
    11071108
    11081109       */
     
    11111112
    11121113       /*
    1113         Delete the ith element of object v.  Returns
    1114         -1 on failure.  This is the equivalent of the Python
    1115         statement: del o[i].
     1114    Delete the ith element of object v.  Returns
     1115    -1 on failure.  This is the equivalent of the Python
     1116    statement: del o[i].
    11161117       */
    11171118
     
    11201121
    11211122       /*
    1122          Assign the sequence object, v, to the slice in sequence
    1123         object, o, from i1 to i2.  Returns -1 on failure. This is the
    1124         equivalent of the Python statement: o[i1:i2]=v.
     1123     Assign the sequence object, v, to the slice in sequence
     1124    object, o, from i1 to i2.  Returns -1 on failure. This is the
     1125    equivalent of the Python statement: o[i1:i2]=v.
    11251126       */
    11261127
     
    11281129
    11291130       /*
    1130         Delete the slice in sequence object, o, from i1 to i2.
    1131         Returns -1 on failure. This is the equivalent of the Python
    1132         statement: del o[i1:i2].
     1131    Delete the slice in sequence object, o, from i1 to i2.
     1132    Returns -1 on failure. This is the equivalent of the Python
     1133    statement: del o[i1:i2].
    11331134       */
    11341135
     
    11361137
    11371138       /*
    1138         Returns the sequence, o, as a tuple on success, and NULL on failure.
    1139         This is equivalent to the Python expression: tuple(o)
     1139    Returns the sequence, o, as a tuple on success, and NULL on failure.
     1140    This is equivalent to the Python expression: tuple(o)
    11401141       */
    11411142
     
    11431144     PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o);
    11441145       /*
    1145         Returns the sequence, o, as a list on success, and NULL on failure.
    1146         This is equivalent to the Python expression: list(o)
     1146    Returns the sequence, o, as a list on success, and NULL on failure.
     1147    This is equivalent to the Python expression: list(o)
    11471148       */
    11481149
    11491150     PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
    11501151       /*
    1151          Returns the sequence, o, as a tuple, unless it's already a
    1152          tuple or list.  Use PySequence_Fast_GET_ITEM to access the
    1153          members of this list, and PySequence_Fast_GET_SIZE to get its length.
    1154 
    1155          Returns NULL on failure.  If the object does not support iteration,
    1156          raises a TypeError exception with m as the message text.
     1152     Returns the sequence, o, as a tuple, unless it's already a
     1153     tuple or list.  Use PySequence_Fast_GET_ITEM to access the
     1154     members of this list, and PySequence_Fast_GET_SIZE to get its length.
     1155
     1156     Returns NULL on failure.  If the object does not support iteration,
     1157     raises a TypeError exception with m as the message text.
    11571158       */
    11581159
    11591160#define PySequence_Fast_GET_SIZE(o) \
    1160         (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o))
    1161        /*
    1162         Return the size of o, assuming that o was returned by
    1163          PySequence_Fast and is not NULL.
     1161    (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o))
     1162       /*
     1163    Return the size of o, assuming that o was returned by
     1164     PySequence_Fast and is not NULL.
    11641165       */
    11651166
     
    11671168     (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
    11681169       /*
    1169         Return the ith element of o, assuming that o was returned by
    1170          PySequence_Fast, and that i is within bounds.
     1170    Return the ith element of o, assuming that o was returned by
     1171     PySequence_Fast, and that i is within bounds.
    11711172       */
    11721173
    11731174#define PySequence_ITEM(o, i)\
    1174         ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) )
     1175    ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) )
    11751176       /* Assume tp_as_sequence and sq_item exist and that i does not
    1176           need to be corrected for a negative index
    1177        */     
     1177      need to be corrected for a negative index
     1178       */
    11781179
    11791180#define PySequence_Fast_ITEMS(sf) \
    1180         (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \
    1181                           : ((PyTupleObject *)(sf))->ob_item)
    1182         /* Return a pointer to the underlying item array for
    1183            an object retured by PySequence_Fast */
     1181    (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \
     1182                      : ((PyTupleObject *)(sf))->ob_item)
     1183    /* Return a pointer to the underlying item array for
     1184       an object retured by PySequence_Fast */
    11841185
    11851186     PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value);
    11861187
    11871188       /*
    1188          Return the number of occurrences on value on o, that is,
    1189         return the number of keys for which o[key]==value.  On
    1190         failure, return -1.  This is equivalent to the Python
    1191         expression: o.count(value).
     1189     Return the number of occurrences on value on o, that is,
     1190    return the number of keys for which o[key]==value.  On
     1191    failure, return -1.  This is equivalent to the Python
     1192    expression: o.count(value).
    11921193       */
    11931194
    11941195     PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob);
    11951196       /*
    1196          Return -1 if error; 1 if ob in seq; 0 if ob not in seq.
    1197          Use __contains__ if possible, else _PySequence_IterSearch().
     1197     Return -1 if error; 1 if ob in seq; 0 if ob not in seq.
     1198     Use __contains__ if possible, else _PySequence_IterSearch().
    11981199       */
    11991200
     
    12021203#define PY_ITERSEARCH_CONTAINS 3
    12031204     PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq,
    1204                                         PyObject *obj, int operation);
    1205         /*
    1206           Iterate over seq.  Result depends on the operation:
    1207           PY_ITERSEARCH_COUNT:  return # of times obj appears in seq; -1 if
    1208                 error.
    1209           PY_ITERSEARCH_INDEX:  return 0-based index of first occurrence of
    1210                 obj in seq; set ValueError and return -1 if none found;
    1211                 also return -1 on error.
    1212           PY_ITERSEARCH_CONTAINS:  return 1 if obj in seq, else 0; -1 on
    1213                 error.
    1214         */
     1205                                        PyObject *obj, int operation);
     1206    /*
     1207      Iterate over seq.  Result depends on the operation:
     1208      PY_ITERSEARCH_COUNT:  return # of times obj appears in seq; -1 if
     1209        error.
     1210      PY_ITERSEARCH_INDEX:  return 0-based index of first occurrence of
     1211        obj in seq; set ValueError and return -1 if none found;
     1212        also return -1 on error.
     1213      PY_ITERSEARCH_CONTAINS:  return 1 if obj in seq, else 0; -1 on
     1214        error.
     1215    */
    12151216
    12161217/* For DLL-level backwards compatibility */
     
    12221223
    12231224       /*
    1224         Determine if o contains value.  If an item in o is equal to
    1225         X, return 1, otherwise return 0.  On error, return -1.  This
    1226         is equivalent to the Python expression: value in o.
     1225    Determine if o contains value.  If an item in o is equal to
     1226    X, return 1, otherwise return 0.  On error, return -1.  This
     1227    is equivalent to the Python expression: value in o.
    12271228       */
    12281229
     
    12301231
    12311232       /*
    1232         Return the first index for which o[i]=value.  On error,
    1233         return -1.    This is equivalent to the Python
    1234         expression: o.index(value).
     1233    Return the first index for which o[i]=value.  On error,
     1234    return -1.    This is equivalent to the Python
     1235    expression: o.index(value).
    12351236       */
    12361237
     
    12401241
    12411242       /*
    1242         Append o2 to o1, in-place when possible. Return the resulting
    1243         object, which could be o1, or NULL on failure.  This is the
    1244         equivalent of the Python expression: o1 += o2.
     1243    Append o2 to o1, in-place when possible. Return the resulting
     1244    object, which could be o1, or NULL on failure.  This is the
     1245    equivalent of the Python expression: o1 += o2.
    12451246
    12461247       */
     
    12491250
    12501251       /*
    1251         Repeat o1 by count, in-place when possible. Return the resulting
    1252         object, which could be o1, or NULL on failure.  This is the
    1253         equivalent of the Python expression: o1 *= count.
     1252    Repeat o1 by count, in-place when possible. Return the resulting
     1253    object, which could be o1, or NULL on failure.  This is the
     1254    equivalent of the Python expression: o1 *= count.
    12541255
    12551256       */
     
    12601261
    12611262       /*
    1262          Return 1 if the object provides mapping protocol, and zero
    1263          otherwise. 
    1264 
    1265         This function always succeeds.
     1263     Return 1 if the object provides mapping protocol, and zero
     1264     otherwise.
     1265
     1266    This function always succeeds.
    12661267       */
    12671268
     
    12691270
    12701271       /*
    1271          Returns the number of keys in object o on success, and -1 on
    1272         failure.  For objects that do not provide sequence protocol,
    1273         this is equivalent to the Python expression: len(o).
     1272     Returns the number of keys in object o on success, and -1 on
     1273    failure.  For objects that do not provide sequence protocol,
     1274    this is equivalent to the Python expression: len(o).
    12741275       */
    12751276
     
    12841285     int PyMapping_DelItemString(PyObject *o, char *key);
    12851286
    1286         Remove the mapping for object, key, from the object *o.
    1287         Returns -1 on failure.  This is equivalent to
    1288         the Python statement: del o[key].
     1287    Remove the mapping for object, key, from the object *o.
     1288    Returns -1 on failure.  This is equivalent to
     1289    the Python statement: del o[key].
    12891290       */
    12901291#define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K))
     
    12941295     int PyMapping_DelItem(PyObject *o, PyObject *key);
    12951296
    1296         Remove the mapping for object, key, from the object *o.
    1297         Returns -1 on failure.  This is equivalent to
    1298         the Python statement: del o[key].
     1297    Remove the mapping for object, key, from the object *o.
     1298    Returns -1 on failure.  This is equivalent to
     1299    the Python statement: del o[key].
    12991300       */
    13001301#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
     
    13031304
    13041305       /*
    1305         On success, return 1 if the mapping object has the key, key,
    1306         and 0 otherwise.  This is equivalent to the Python expression:
    1307          o.has_key(key).
    1308 
    1309         This function always succeeds.
     1306    On success, return 1 if the mapping object has the key, key,
     1307    and 0 otherwise.  This is equivalent to the Python expression:
     1308     o.has_key(key).
     1309
     1310    This function always succeeds.
    13101311       */
    13111312
     
    13131314
    13141315       /*
    1315         Return 1 if the mapping object has the key, key,
    1316         and 0 otherwise.  This is equivalent to the Python expression:
    1317          o.has_key(key).
    1318 
    1319         This function always succeeds.
     1316    Return 1 if the mapping object has the key, key,
     1317    and 0 otherwise.  This is equivalent to the Python expression:
     1318     o.has_key(key).
     1319
     1320    This function always succeeds.
    13201321
    13211322       */
     
    13251326     PyObject *PyMapping_Keys(PyObject *o);
    13261327
    1327          On success, return a list of the keys in object o.  On
    1328         failure, return NULL. This is equivalent to the Python
    1329         expression: o.keys().
     1328     On success, return a list of the keys in object o.  On
     1329    failure, return NULL. This is equivalent to the Python
     1330    expression: o.keys().
    13301331       */
    13311332#define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL)
     
    13351336     PyObject *PyMapping_Values(PyObject *o);
    13361337
    1337          On success, return a list of the values in object o.  On
    1338         failure, return NULL. This is equivalent to the Python
    1339         expression: o.values().
     1338     On success, return a list of the values in object o.  On
     1339    failure, return NULL. This is equivalent to the Python
     1340    expression: o.values().
    13401341       */
    13411342#define PyMapping_Values(O) PyObject_CallMethod(O,"values",NULL)
     
    13451346     PyObject *PyMapping_Items(PyObject *o);
    13461347
    1347          On success, return a list of the items in object o, where
    1348         each item is a tuple containing a key-value pair.  On
    1349         failure, return NULL. This is equivalent to the Python
    1350         expression: o.items().
     1348     On success, return a list of the items in object o, where
     1349    each item is a tuple containing a key-value pair.  On
     1350    failure, return NULL. This is equivalent to the Python
     1351    expression: o.items().
    13511352
    13521353       */
     
    13561357
    13571358       /*
    1358         Return element of o corresponding to the object, key, or NULL
    1359         on failure. This is the equivalent of the Python expression:
    1360         o[key].
     1359    Return element of o corresponding to the object, key, or NULL
     1360    on failure. This is the equivalent of the Python expression:
     1361    o[key].
    13611362       */
    13621363
     
    13651366
    13661367       /*
    1367          Map the object, key, to the value, v.  Returns
    1368         -1 on failure.  This is the equivalent of the Python
    1369         statement: o[key]=v.
     1368     Map the object, key, to the value, v.  Returns
     1369    -1 on failure.  This is the equivalent of the Python
     1370    statement: o[key]=v.
    13701371      */
    13711372
     
    13811382
    13821383PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
     1384
     1385
     1386/* For internal use by buffer API functions */
     1387PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index,
     1388                                        const Py_ssize_t *shape);
     1389PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
     1390                                        const Py_ssize_t *shape);
    13831391
    13841392
  • python/vendor/current/Include/bytes_methods.h

    r2 r388  
    3535extern const char _Py_swapcase__doc__[];
    3636
    37 #define FLAG_LOWER  0x01
    38 #define FLAG_UPPER  0x02
    39 #define FLAG_ALPHA  (FLAG_LOWER|FLAG_UPPER)
    40 #define FLAG_DIGIT  0x04
    41 #define FLAG_ALNUM  (FLAG_ALPHA|FLAG_DIGIT)
    42 #define FLAG_SPACE  0x08
    43 #define FLAG_XDIGIT 0x10
    44 
    45 extern const unsigned int _Py_ctype_table[256];
    46 
    47 #define ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_LOWER)
    48 #define ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_UPPER)
    49 #define ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_ALPHA)
    50 #define ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_DIGIT)
    51 #define ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_XDIGIT)
    52 #define ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_ALNUM)
    53 #define ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_SPACE)
     37/* These are left in for backward compatibility and will be removed
     38   in 2.8/3.2 */
     39#define ISLOWER(c)  Py_ISLOWER(c)
     40#define ISUPPER(c)  Py_ISUPPER(c)
     41#define ISALPHA(c)  Py_ISALPHA(c)
     42#define ISDIGIT(c)  Py_ISDIGIT(c)
     43#define ISXDIGIT(c) Py_ISXDIGIT(c)
     44#define ISALNUM(c)  Py_ISALNUM(c)
     45#define ISSPACE(c)  Py_ISSPACE(c)
    5446
    5547#undef islower
     
    6860#define isspace(c) undefined_isspace(c)
    6961
    70 extern const unsigned char _Py_ctype_tolower[256];
    71 extern const unsigned char _Py_ctype_toupper[256];
    72 
    73 #define TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)])
    74 #define TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
     62/* These are left in for backward compatibility and will be removed
     63   in 2.8/3.2 */
     64#define TOLOWER(c) Py_TOLOWER(c)
     65#define TOUPPER(c) Py_TOUPPER(c)
    7566
    7667#undef tolower
  • python/vendor/current/Include/bytesobject.h

    r2 r388  
    2424#define PyBytes_DecodeEscape PyString_DecodeEscape
    2525#define _PyBytes_Join _PyString_Join
    26 #define PyBytes_Decode PyString_Decode
    27 #define PyBytes_Encode PyString_Encode
    28 #define PyBytes_AsEncodedObject PyString_AsEncodedObject
    29 #define PyBytes_AsEncodedString PyString_AsEncodedString
    30 #define PyBytes_AsDecodedObject PyString_AsDecodedObject
    31 #define PyBytes_AsDecodedString PyString_AsDecodedString
    3226#define PyBytes_AsStringAndSize PyString_AsStringAndSize
    3327#define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping
  • python/vendor/current/Include/cStringIO.h

    r2 r388  
    88  This header provides access to cStringIO objects from C.
    99  Functions are provided for calling cStringIO objects and
    10   macros are provided for testing whether you have cStringIO 
     10  macros are provided for testing whether you have cStringIO
    1111  objects.
    1212
     
    1919
    2020*/
     21
     22#define PycStringIO_CAPSULE_NAME "cStringIO.cStringIO_CAPI"
     23
    2124#define PycString_IMPORT \
    22   PycStringIO = (struct PycStringIO_CAPI*)PyCObject_Import("cStringIO", \
    23                                                            "cStringIO_CAPI")
     25  PycStringIO = ((struct PycStringIO_CAPI*)PyCapsule_Import(\
     26    PycStringIO_CAPSULE_NAME, 0))
    2427
    2528/* Basic functions to manipulate cStringIO objects from C */
    2629
    2730static struct PycStringIO_CAPI {
    28  
     31
    2932 /* Read a string from an input object.  If the last argument
    3033    is -1, the remainder will be read.
  • python/vendor/current/Include/ceval.h

    r2 r388  
    99
    1010PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
    11         PyObject *, PyObject *, PyObject *);
    12 
    13 /* DLL-level Backwards compatibility: */
    14 #undef PyEval_CallObject
    15 PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *);
     11    PyObject *, PyObject *, PyObject *);
    1612
    1713/* Inline this */
    1814#define PyEval_CallObject(func,arg) \
    19         PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
     15    PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
    2016
    2117PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj,
     
    5147
    5248#define Py_EnterRecursiveCall(where)                                    \
    53             (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) &&  \
    54              _Py_CheckRecursiveCall(where))
    55 #define Py_LeaveRecursiveCall()                         \
    56             (--PyThreadState_GET()->recursion_depth)
     49            (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) &&  \
     50             _Py_CheckRecursiveCall(where))
     51#define Py_LeaveRecursiveCall()                         \
     52            (--PyThreadState_GET()->recursion_depth)
    5753PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where);
    5854PyAPI_DATA(int) _Py_CheckRecursionLimit;
     
    8076   threads to run as follows:
    8177
    82         ...preparations here...
    83         Py_BEGIN_ALLOW_THREADS
    84         ...blocking system call here...
    85         Py_END_ALLOW_THREADS
    86         ...interpret result here...
     78    ...preparations here...
     79    Py_BEGIN_ALLOW_THREADS
     80    ...blocking system call here...
     81    Py_END_ALLOW_THREADS
     82    ...interpret result here...
    8783
    8884   The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
     
    9187   a line containing Py_BLOCK_THREADS before the return, e.g.
    9288
    93         if (...premature_exit...) {
    94                 Py_BLOCK_THREADS
    95                 PyErr_SetFromErrno(PyExc_IOError);
    96                 return NULL;
    97         }
     89    if (...premature_exit...) {
     90        Py_BLOCK_THREADS
     91        PyErr_SetFromErrno(PyExc_IOError);
     92        return NULL;
     93    }
    9894
    9995   An alternative is:
    10096
    101         Py_BLOCK_THREADS
    102         if (...premature_exit...) {
    103                 PyErr_SetFromErrno(PyExc_IOError);
    104                 return NULL;
    105         }
    106         Py_UNBLOCK_THREADS
     97    Py_BLOCK_THREADS
     98    if (...premature_exit...) {
     99        PyErr_SetFromErrno(PyExc_IOError);
     100        return NULL;
     101    }
     102    Py_UNBLOCK_THREADS
    107103
    108104   For convenience, that the value of 'errno' is restored across
     
    133129
    134130#define Py_BEGIN_ALLOW_THREADS { \
    135                         PyThreadState *_save; \
    136                         _save = PyEval_SaveThread();
    137 #define Py_BLOCK_THREADS        PyEval_RestoreThread(_save);
    138 #define Py_UNBLOCK_THREADS      _save = PyEval_SaveThread();
    139 #define Py_END_ALLOW_THREADS    PyEval_RestoreThread(_save); \
    140                 }
     131                        PyThreadState *_save; \
     132                        _save = PyEval_SaveThread();
     133#define Py_BLOCK_THREADS        PyEval_RestoreThread(_save);
     134#define Py_UNBLOCK_THREADS      _save = PyEval_SaveThread();
     135#define Py_END_ALLOW_THREADS    PyEval_RestoreThread(_save); \
     136                }
    141137
    142138#else /* !WITH_THREAD */
  • python/vendor/current/Include/classobject.h

    r2 r388  
    1919    PyObject    *cl_setattr;
    2020    PyObject    *cl_delattr;
     21    PyObject    *cl_weakreflist; /* List of weak references */
    2122} PyClassObject;
    2223
  • python/vendor/current/Include/cobject.h

    r2 r388  
     1/*
     2   CObjects are marked Pending Deprecation as of Python 2.7.
     3   The full schedule for 2.x is as follows:
     4     - CObjects are marked Pending Deprecation in Python 2.7.
     5     - CObjects will be marked Deprecated in Python 2.8
     6       (if there is one).
     7     - CObjects will be removed in Python 2.9 (if there is one).
     8
     9   Additionally, for the Python 3.x series:
     10     - CObjects were marked Deprecated in Python 3.1.
     11     - CObjects will be removed in Python 3.2.
     12
     13   You should switch all use of CObjects to capsules.  Capsules
     14   have a safer and more consistent API.  For more information,
     15   see Include/pycapsule.h, or read the "Capsules" topic in
     16   the "Python/C API Reference Manual".
     17
     18   Python 2.7 no longer uses CObjects itself; all objects which
     19   were formerly CObjects are now capsules.  Note that this change
     20   does not by itself break binary compatibility with extensions
     21   built for previous versions of Python--PyCObject_AsVoidPtr()
     22   has been changed to also understand capsules.
     23
     24*/
     25
     26/* original file header comment follows: */
    127
    228/* C objects to be exported from one extension module to another.
  • python/vendor/current/Include/code.h

    r2 r388  
    2424    PyObject *co_name;          /* string (name, for reference) */
    2525    int co_firstlineno;         /* first source line number */
    26     PyObject *co_lnotab;        /* string (encoding addr<->lineno mapping) */
     26    PyObject *co_lnotab;        /* string (encoding addr<->lineno mapping) See
     27                                   Objects/lnotab_notes.txt for details. */
    2728    void *co_zombieframe;     /* for optimization only (see frameobject.c) */
     29    PyObject *co_weakreflist;   /* to support weakrefs to code objects */
    2830} PyCodeObject;
    2931
     
    7173        PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *);
    7274        /* same as struct above */
     75
     76/* Creates a new empty code object with the specified source location. */
     77PyAPI_FUNC(PyCodeObject *)
     78PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);
     79
     80/* Return the line number associated with the specified bytecode index
     81   in this code object.  If you just need the line number of a frame,
     82   use PyFrame_GetLineNumber() instead. */
    7383PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
    7484
     
    8393} PyAddrPair;
    8494
    85 /* Check whether lasti (an instruction offset) falls outside bounds
    86    and whether it is a line number that should be traced.  Returns
    87    a line number if it should be traced or -1 if the line should not.
    88 
    89    If lasti is not within bounds, updates bounds.
     95/* Update *bounds to describe the first and one-past-the-last instructions in the
     96   same line as lasti.  Return the number of that line.
    9097*/
    91 
    92 PyAPI_FUNC(int) PyCode_CheckLineNumber(PyCodeObject* co,
    93                                        int lasti, PyAddrPair *bounds);
     98PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
     99                                        int lasti, PyAddrPair *bounds);
    94100
    95101PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
  • python/vendor/current/Include/codecs.h

    r2 r388  
    134134/* Unicode encoding error handling callback registry API */
    135135
    136 /* Register the error handling callback function error under the name
     136/* Register the error handling callback function error under the given
    137137   name. This function will be called by the codec when it encounters
    138138   unencodable characters/undecodable bytes and doesn't know the
     
    142142PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error);
    143143
    144 /* Lookup the error handling callback function registered under the
    145    name error. As a special case NULL can be passed, in which case
     144/* Lookup the error handling callback function registered under the given
     145   name. As a special case NULL can be passed, in which case
    146146   the error handling callback for "strict" will be returned. */
    147147PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name);
     
    153153PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc);
    154154
    155 /* replace the unicode error with ? or U+FFFD */
     155/* replace the unicode encode error with ? or U+FFFD */
    156156PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc);
    157157
  • python/vendor/current/Include/compile.h

    r2 r388  
    3434PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *);
    3535
    36 #define ERR_LATE_FUTURE \
    37 "from __future__ imports must occur at the beginning of the file"
    3836
    3937#ifdef __cplusplus
  • python/vendor/current/Include/complexobject.h

    r2 r388  
    5555PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
    5656
     57/* Format the object based on the format_spec, as defined in PEP 3101
     58   (Advanced String Formatting). */
     59PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj,
     60                                                 char *format_spec,
     61                                                 Py_ssize_t format_spec_len);
     62
    5763#ifdef __cplusplus
    5864}
  • python/vendor/current/Include/datetime.h

    r2 r388  
    1212 *
    1313 * byte offset
    14  *  0           year     2 bytes, 1-9999
    15  *  2           month    1 byte, 1-12
    16  *  3           day      1 byte, 1-31
    17  *  4           hour     1 byte, 0-23
    18  *  5           minute   1 byte, 0-59
    19  *  6           second   1 byte, 0-59
    20  *  7           usecond  3 bytes, 0-999999
     14 *  0           year     2 bytes, 1-9999
     15 *  2           month    1 byte, 1-12
     16 *  3           day      1 byte, 1-31
     17 *  4           hour     1 byte, 0-23
     18 *  5           minute   1 byte, 0-59
     19 *  6           second   1 byte, 0-59
     20 *  7           usecond  3 bytes, 0-999999
    2121 * 10
    2222 */
     
    3434typedef struct
    3535{
    36         PyObject_HEAD
    37         long hashcode;          /* -1 when unknown */
    38         int days;               /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
    39         int seconds;            /* 0 <= seconds < 24*3600 is invariant */
    40         int microseconds;       /* 0 <= microseconds < 1000000 is invariant */
     36    PyObject_HEAD
     37    long hashcode;              /* -1 when unknown */
     38    int days;                   /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
     39    int seconds;                /* 0 <= seconds < 24*3600 is invariant */
     40    int microseconds;           /* 0 <= microseconds < 1000000 is invariant */
    4141} PyDateTime_Delta;
    4242
    4343typedef struct
    4444{
    45         PyObject_HEAD           /* a pure abstract base clase */
     45    PyObject_HEAD               /* a pure abstract base class */
    4646} PyDateTime_TZInfo;
    4747
     
    5050 * present if and only if hastzinfo is true.
    5151 */
    52 #define _PyTZINFO_HEAD          \
    53         PyObject_HEAD           \
    54         long hashcode;          \
    55         char hastzinfo;         /* boolean flag */
     52#define _PyTZINFO_HEAD          \
     53    PyObject_HEAD               \
     54    long hashcode;              \
     55    char hastzinfo;             /* boolean flag */
    5656
    5757/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something
     
    6161typedef struct
    6262{
    63         _PyTZINFO_HEAD
     63    _PyTZINFO_HEAD
    6464} _PyDateTime_BaseTZInfo;
    6565
     
    7070 * "without" case.
    7171 */
    72 #define _PyDateTime_TIMEHEAD    \
    73         _PyTZINFO_HEAD          \
    74         unsigned char data[_PyDateTime_TIME_DATASIZE];
    75 
    76 typedef struct
    77 {
    78         _PyDateTime_TIMEHEAD
    79 } _PyDateTime_BaseTime;         /* hastzinfo false */
    80 
    81 typedef struct
    82 {
    83         _PyDateTime_TIMEHEAD
    84         PyObject *tzinfo;
    85 } PyDateTime_Time;              /* hastzinfo true */
     72#define _PyDateTime_TIMEHEAD    \
     73    _PyTZINFO_HEAD              \
     74    unsigned char data[_PyDateTime_TIME_DATASIZE];
     75
     76typedef struct
     77{
     78    _PyDateTime_TIMEHEAD
     79} _PyDateTime_BaseTime;         /* hastzinfo false */
     80
     81typedef struct
     82{
     83    _PyDateTime_TIMEHEAD
     84    PyObject *tzinfo;
     85} PyDateTime_Time;              /* hastzinfo true */
    8686
    8787
     
    9393typedef struct
    9494{
    95         _PyTZINFO_HEAD
    96         unsigned char data[_PyDateTime_DATE_DATASIZE];
     95    _PyTZINFO_HEAD
     96    unsigned char data[_PyDateTime_DATE_DATASIZE];
    9797} PyDateTime_Date;
    9898
    99 #define _PyDateTime_DATETIMEHEAD        \
    100         _PyTZINFO_HEAD                  \
    101         unsigned char data[_PyDateTime_DATETIME_DATASIZE];
    102 
    103 typedef struct
    104 {
    105         _PyDateTime_DATETIMEHEAD
    106 } _PyDateTime_BaseDateTime;     /* hastzinfo false */
    107 
    108 typedef struct
    109 {
    110         _PyDateTime_DATETIMEHEAD
    111         PyObject *tzinfo;
    112 } PyDateTime_DateTime;          /* hastzinfo true */
     99#define _PyDateTime_DATETIMEHEAD        \
     100    _PyTZINFO_HEAD                      \
     101    unsigned char data[_PyDateTime_DATETIME_DATASIZE];
     102
     103typedef struct
     104{
     105    _PyDateTime_DATETIMEHEAD
     106} _PyDateTime_BaseDateTime;     /* hastzinfo false */
     107
     108typedef struct
     109{
     110    _PyDateTime_DATETIMEHEAD
     111    PyObject *tzinfo;
     112} PyDateTime_DateTime;          /* hastzinfo true */
    113113
    114114
    115115/* Apply for date and datetime instances. */
    116116#define PyDateTime_GET_YEAR(o)     ((((PyDateTime_Date*)o)->data[0] << 8) | \
    117                                      ((PyDateTime_Date*)o)->data[1])
     117                     ((PyDateTime_Date*)o)->data[1])
    118118#define PyDateTime_GET_MONTH(o)    (((PyDateTime_Date*)o)->data[2])
    119119#define PyDateTime_GET_DAY(o)      (((PyDateTime_Date*)o)->data[3])
     
    122122#define PyDateTime_DATE_GET_MINUTE(o)      (((PyDateTime_DateTime*)o)->data[5])
    123123#define PyDateTime_DATE_GET_SECOND(o)      (((PyDateTime_DateTime*)o)->data[6])
    124 #define PyDateTime_DATE_GET_MICROSECOND(o)              \
    125         ((((PyDateTime_DateTime*)o)->data[7] << 16) |   \
    126          (((PyDateTime_DateTime*)o)->data[8] << 8)  |   \
    127           ((PyDateTime_DateTime*)o)->data[9])
     124#define PyDateTime_DATE_GET_MICROSECOND(o)              \
     125    ((((PyDateTime_DateTime*)o)->data[7] << 16) |       \
     126     (((PyDateTime_DateTime*)o)->data[8] << 8)  |       \
     127      ((PyDateTime_DateTime*)o)->data[9])
    128128
    129129/* Apply for time instances. */
     
    131131#define PyDateTime_TIME_GET_MINUTE(o)      (((PyDateTime_Time*)o)->data[1])
    132132#define PyDateTime_TIME_GET_SECOND(o)      (((PyDateTime_Time*)o)->data[2])
    133 #define PyDateTime_TIME_GET_MICROSECOND(o)              \
    134         ((((PyDateTime_Time*)o)->data[3] << 16) |       \
    135          (((PyDateTime_Time*)o)->data[4] << 8)  |       \
    136           ((PyDateTime_Time*)o)->data[5])
     133#define PyDateTime_TIME_GET_MICROSECOND(o)              \
     134    ((((PyDateTime_Time*)o)->data[3] << 16) |           \
     135     (((PyDateTime_Time*)o)->data[4] << 8)  |           \
     136      ((PyDateTime_Time*)o)->data[5])
    137137
    138138
     
    149149    PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*);
    150150    PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int,
    151             PyObject*, PyTypeObject*);
     151        PyObject*, PyTypeObject*);
    152152    PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*);
    153153    PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*);
     
    159159} PyDateTime_CAPI;
    160160
     161#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI"
     162
    161163
    162164/* "magic" constant used to partially protect against developer mistakes. */
     
    184186
    185187/* Define global variable for the C API and a macro for setting it. */
    186 static PyDateTime_CAPI *PyDateTimeAPI;
     188static PyDateTime_CAPI *PyDateTimeAPI = NULL;
    187189
    188190#define PyDateTime_IMPORT \
    189         PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import("datetime", \
    190                                                             "datetime_CAPI")
    191 
    192 /* This macro would be used if PyCObject_ImportEx() was created.
    193 #define PyDateTime_IMPORT \
    194         PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_ImportEx("datetime", \
    195                                                             "datetime_CAPI", \
    196                                                             DATETIME_API_MAGIC)
    197 */
     191    PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)
    198192
    199193/* Macros for type checking when not building the Python core. */
     
    215209/* Macros for accessing constructors in a simplified fashion. */
    216210#define PyDate_FromDate(year, month, day) \
    217         PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType)
     211    PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType)
    218212
    219213#define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \
    220         PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \
    221                 min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType)
     214    PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \
     215        min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType)
    222216
    223217#define PyTime_FromTime(hour, minute, second, usecond) \
    224         PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \
    225                 Py_None, PyDateTimeAPI->TimeType)
     218    PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \
     219        Py_None, PyDateTimeAPI->TimeType)
    226220
    227221#define PyDelta_FromDSU(days, seconds, useconds) \
    228         PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \
    229                 PyDateTimeAPI->DeltaType)
     222    PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \
     223        PyDateTimeAPI->DeltaType)
    230224
    231225/* Macros supporting the DB API. */
    232226#define PyDateTime_FromTimestamp(args) \
    233         PyDateTimeAPI->DateTime_FromTimestamp( \
    234                 (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL)
     227    PyDateTimeAPI->DateTime_FromTimestamp( \
     228        (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL)
    235229
    236230#define PyDate_FromTimestamp(args) \
    237         PyDateTimeAPI->Date_FromTimestamp( \
    238                 (PyObject*) (PyDateTimeAPI->DateType), args)
    239 
    240 #endif  /* Py_BUILD_CORE */
     231    PyDateTimeAPI->Date_FromTimestamp( \
     232        (PyObject*) (PyDateTimeAPI->DateType), args)
     233
     234#endif  /* Py_BUILD_CORE */
    241235
    242236#ifdef __cplusplus
  • python/vendor/current/Include/descrobject.h

    r2 r388  
    1010
    1111typedef struct PyGetSetDef {
    12         char *name;
    13         getter get;
    14         setter set;
    15         char *doc;
    16         void *closure;
     12    char *name;
     13    getter get;
     14    setter set;
     15    char *doc;
     16    void *closure;
    1717} PyGetSetDef;
    1818
    1919typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
    20                                 void *wrapped);
     20                                void *wrapped);
    2121
    2222typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
    23                                       void *wrapped, PyObject *kwds);
     23                                      void *wrapped, PyObject *kwds);
    2424
    2525struct wrapperbase {
    26         char *name;
    27         int offset;
    28         void *function;
    29         wrapperfunc wrapper;
    30         char *doc;
    31         int flags;
    32         PyObject *name_strobj;
     26    char *name;
     27    int offset;
     28    void *function;
     29    wrapperfunc wrapper;
     30    char *doc;
     31    int flags;
     32    PyObject *name_strobj;
    3333};
    3434
     
    3939
    4040#define PyDescr_COMMON \
    41         PyObject_HEAD \
    42         PyTypeObject *d_type; \
    43         PyObject *d_name
     41    PyObject_HEAD \
     42    PyTypeObject *d_type; \
     43    PyObject *d_name
    4444
    4545typedef struct {
    46         PyDescr_COMMON;
     46    PyDescr_COMMON;
    4747} PyDescrObject;
    4848
    4949typedef struct {
    50         PyDescr_COMMON;
    51         PyMethodDef *d_method;
     50    PyDescr_COMMON;
     51    PyMethodDef *d_method;
    5252} PyMethodDescrObject;
    5353
    5454typedef struct {
    55         PyDescr_COMMON;
    56         struct PyMemberDef *d_member;
     55    PyDescr_COMMON;
     56    struct PyMemberDef *d_member;
    5757} PyMemberDescrObject;
    5858
    5959typedef struct {
    60         PyDescr_COMMON;
    61         PyGetSetDef *d_getset;
     60    PyDescr_COMMON;
     61    PyGetSetDef *d_getset;
    6262} PyGetSetDescrObject;
    6363
    6464typedef struct {
    65         PyDescr_COMMON;
    66         struct wrapperbase *d_base;
    67         void *d_wrapped; /* This can be any function pointer */
     65    PyDescr_COMMON;
     66    struct wrapperbase *d_base;
     67    void *d_wrapped; /* This can be any function pointer */
    6868} PyWrapperDescrObject;
    6969
     
    7676PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
    7777PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
    78                                                struct PyMemberDef *);
     78                                               struct PyMemberDef *);
    7979PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
    80                                                struct PyGetSetDef *);
     80                                               struct PyGetSetDef *);
    8181PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
    82                                                 struct wrapperbase *, void *);
     82                                                struct wrapperbase *, void *);
    8383#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
    8484
  • python/vendor/current/Include/dictobject.h

    r2 r388  
    4949
    5050typedef struct {
    51         /* Cached hash code of me_key.  Note that hash codes are C longs.
    52         * We have to use Py_ssize_t instead because dict_popitem() abuses
    53         * me_hash to hold a search finger.
    54         */
    55         Py_ssize_t me_hash;
    56         PyObject *me_key;
    57         PyObject *me_value;
     51    /* Cached hash code of me_key.  Note that hash codes are C longs.
     52    * We have to use Py_ssize_t instead because dict_popitem() abuses
     53    * me_hash to hold a search finger.
     54    */
     55    Py_ssize_t me_hash;
     56    PyObject *me_key;
     57    PyObject *me_value;
    5858} PyDictEntry;
    5959
     
    6969typedef struct _dictobject PyDictObject;
    7070struct _dictobject {
    71         PyObject_HEAD
    72         Py_ssize_t ma_fill;  /* # Active + # Dummy */
    73         Py_ssize_t ma_used;  /* # Active */
     71    PyObject_HEAD
     72    Py_ssize_t ma_fill;  /* # Active + # Dummy */
     73    Py_ssize_t ma_used;  /* # Active */
    7474
    75         /* The table contains ma_mask + 1 slots, and that's a power of 2.
    76         * We store the mask instead of the size because the mask is more
    77         * frequently needed.
    78         */
    79         Py_ssize_t ma_mask;
     75    /* The table contains ma_mask + 1 slots, and that's a power of 2.
     76    * We store the mask instead of the size because the mask is more
     77    * frequently needed.
     78    */
     79    Py_ssize_t ma_mask;
    8080
    81         /* ma_table points to ma_smalltable for small tables, else to
    82         * additional malloc'ed memory.  ma_table is never NULL!  This rule
    83         * saves repeated runtime null-tests in the workhorse getitem and
    84         * setitem calls.
    85         */
    86         PyDictEntry *ma_table;
    87         PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
    88         PyDictEntry ma_smalltable[PyDict_MINSIZE];
     81    /* ma_table points to ma_smalltable for small tables, else to
     82    * additional malloc'ed memory.  ma_table is never NULL!  This rule
     83    * saves repeated runtime null-tests in the workhorse getitem and
     84    * setitem calls.
     85    */
     86    PyDictEntry *ma_table;
     87    PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
     88    PyDictEntry ma_smalltable[PyDict_MINSIZE];
    8989};
    9090
    9191PyAPI_DATA(PyTypeObject) PyDict_Type;
     92PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
     93PyAPI_DATA(PyTypeObject) PyDictIterValue_Type;
     94PyAPI_DATA(PyTypeObject) PyDictIterItem_Type;
     95PyAPI_DATA(PyTypeObject) PyDictKeys_Type;
     96PyAPI_DATA(PyTypeObject) PyDictItems_Type;
     97PyAPI_DATA(PyTypeObject) PyDictValues_Type;
    9298
    9399#define PyDict_Check(op) \
    94100                 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
    95101#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
     102#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type)
     103#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type)
     104#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type)
     105/* This excludes Values, since they are not sets. */
     106# define PyDictViewSet_Check(op) \
     107    (PyDictKeys_Check(op) || PyDictItems_Check(op))
    96108
    97109PyAPI_FUNC(PyObject *) PyDict_New(void);
     
    101113PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
    102114PyAPI_FUNC(int) PyDict_Next(
    103         PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
     115    PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
    104116PyAPI_FUNC(int) _PyDict_Next(
    105         PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash);
     117    PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash);
    106118PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
    107119PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
     
    112124PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash);
    113125PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
     126PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
    114127
    115128/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
     
    122135*/
    123136PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
    124                                    PyObject *other,
    125                                    int override);
     137                                   PyObject *other,
     138                                   int override);
    126139
    127140/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
     
    131144*/
    132145PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
    133                                            PyObject *seq2,
    134                                            int override);
     146                                           PyObject *seq2,
     147                                           int override);
    135148
    136149PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
  • python/vendor/current/Include/fileobject.h

    r2 r388  
    99
    1010typedef struct {
    11         PyObject_HEAD
    12         FILE *f_fp;
    13         PyObject *f_name;
    14         PyObject *f_mode;
    15         int (*f_close)(FILE *);
    16         int f_softspace;        /* Flag used by 'print' command */
    17         int f_binary;           /* Flag which indicates whether the file is
    18                                    open in binary (1) or text (0) mode */
    19         char* f_buf;            /* Allocated readahead buffer */
    20         char* f_bufend;         /* Points after last occupied position */
    21         char* f_bufptr;         /* Current buffer position */
    22         char *f_setbuf;         /* Buffer for setbuf(3) and setvbuf(3) */
    23         int f_univ_newline;     /* Handle any newline convention */
    24         int f_newlinetypes;     /* Types of newlines seen */
    25         int f_skipnextlf;       /* Skip next \n */
    26         PyObject *f_encoding;
    27         PyObject *f_errors;
    28         PyObject *weakreflist; /* List of weak references */
    29         int unlocked_count;     /* Num. currently running sections of code
    30                                    using f_fp with the GIL released. */
    31         int readable;
    32         int writable;
     11    PyObject_HEAD
     12    FILE *f_fp;
     13    PyObject *f_name;
     14    PyObject *f_mode;
     15    int (*f_close)(FILE *);
     16    int f_softspace;            /* Flag used by 'print' command */
     17    int f_binary;               /* Flag which indicates whether the file is
     18                               open in binary (1) or text (0) mode */
     19    char* f_buf;                /* Allocated readahead buffer */
     20    char* f_bufend;             /* Points after last occupied position */
     21    char* f_bufptr;             /* Current buffer position */
     22    char *f_setbuf;             /* Buffer for setbuf(3) and setvbuf(3) */
     23    int f_univ_newline;         /* Handle any newline convention */
     24    int f_newlinetypes;         /* Types of newlines seen */
     25    int f_skipnextlf;           /* Skip next \n */
     26    PyObject *f_encoding;
     27    PyObject *f_errors;
     28    PyObject *weakreflist; /* List of weak references */
     29    int unlocked_count;         /* Num. currently running sections of code
     30                               using f_fp with the GIL released. */
     31    int readable;
     32    int writable;
    3333} PyFileObject;
    3434
     
    7171int _PyFile_SanitizeMode(char *mode);
    7272
     73#if defined _MSC_VER && _MSC_VER >= 1400
     74/* A routine to check if a file descriptor is valid on Windows.  Returns 0
     75 * and sets errno to EBADF if it isn't.  This is to avoid Assertions
     76 * from various functions in the Windows CRT beginning with
     77 * Visual Studio 2005
     78 */
     79int _PyVerify_fd(int fd);
     80#elif defined _MSC_VER && _MSC_VER >= 1200
     81/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */
     82#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0)
     83#else
     84#define _PyVerify_fd(A) (1) /* dummy */
     85#endif
     86
     87/* A routine to check if a file descriptor can be select()-ed. */
     88#ifdef HAVE_SELECT
     89 #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE))
     90#else
     91 #define _PyIsSelectable_fd(FD) (1)
     92#endif /* HAVE_SELECT */
     93
    7394#ifdef __cplusplus
    7495}
  • python/vendor/current/Include/floatobject.h

    r2 r388  
    2121#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
    2222#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type)
     23
     24/* The str() precision PyFloat_STR_PRECISION is chosen so that in most cases,
     25   the rounding noise created by various operations is suppressed, while
     26   giving plenty of precision for practical use. */
     27
     28#define PyFloat_STR_PRECISION 12
    2329
    2430#ifdef Py_NAN
     
    122128                                               Py_ssize_t format_spec_len);
    123129
     130/* Round a C double x to the closest multiple of 10**-ndigits.  Returns a
     131   Python float on success, or NULL (with an appropriate exception set) on
     132   failure.  Used in builtin_round in bltinmodule.c. */
     133PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits);
     134
     135
     136
    124137#ifdef __cplusplus
    125138}
  • python/vendor/current/Include/frameobject.h

    r2 r388  
    3939    PyThreadState *f_tstate;
    4040    int f_lasti;                /* Last instruction if called */
    41     /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when
    42        f_trace is set) -- at other times use PyCode_Addr2Line instead. */
     41    /* Call PyFrame_GetLineNumber() instead of reading this field
     42       directly.  As of 2.3 f_lineno is only valid when tracing is
     43       active (i.e. when f_trace is set).  At other times we use
     44       PyCode_Addr2Line to calculate the line from the current
     45       bytecode index. */
    4346    int f_lineno;               /* Current line number */
    4447    int f_iblock;               /* index in f_blockstack */
     
    7881PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
    7982
     83/* Return the line of code the frame is currently executing. */
     84PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
     85
    8086#ifdef __cplusplus
    8187}
  • python/vendor/current/Include/graminit.h

    r2 r388  
    4343#define try_stmt 296
    4444#define with_stmt 297
    45 #define with_var 298
     45#define with_item 298
    4646#define except_clause 299
    4747#define suite 300
     
    6565#define atom 318
    6666#define listmaker 319
    67 #define testlist_gexp 320
     67#define testlist_comp 320
    6868#define lambdef 321
    6969#define trailer 322
     
    7373#define exprlist 326
    7474#define testlist 327
    75 #define dictmaker 328
     75#define dictorsetmaker 328
    7676#define classdef 329
    7777#define arglist 330
     
    8080#define list_for 333
    8181#define list_if 334
    82 #define gen_iter 335
    83 #define gen_for 336
    84 #define gen_if 337
     82#define comp_iter 335
     83#define comp_for 336
     84#define comp_if 337
    8585#define testlist1 338
    8686#define encoding_decl 339
  • python/vendor/current/Include/import.h

    r2 r388  
    5252PyAPI_DATA(struct _inittab *) PyImport_Inittab;
    5353
    54 PyAPI_FUNC(int) PyImport_AppendInittab(char *name, void (*initfunc)(void));
     54PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void));
    5555PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
    5656
  • python/vendor/current/Include/intobject.h

    r2 r388  
    4141PyAPI_FUNC(long) PyInt_AsLong(PyObject *);
    4242PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *);
     43PyAPI_FUNC(int) _PyInt_AsInt(PyObject *);
    4344PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *);
    4445#ifdef HAVE_LONG_LONG
  • python/vendor/current/Include/longintrepr.h

    r2 r388  
    88/* This is published for the benefit of "friend" marshal.c only. */
    99
    10 /* Parameters of the long integer representation.
    11    These shouldn't have to be changed as C should guarantee that a short
    12    contains at least 16 bits, but it's made changeable anyway.
    13    Note: 'digit' should be able to hold 2*MASK+1, and 'twodigits'
    14    should be able to hold the intermediate results in 'mul'
    15    (at most (BASE-1)*(2*BASE+1) == MASK*(2*MASK+3)).
    16    Also, x_sub assumes that 'digit' is an unsigned type, and overflow
    17    is handled by taking the result mod 2**N for some N > SHIFT.
    18    And, at some places it is assumed that MASK fits in an int, as well.
    19    long_pow() requires that SHIFT be divisible by 5. */
     10/* Parameters of the long integer representation.  There are two different
     11   sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit
     12   integer type, and one set for 15-bit digits with each digit stored in an
     13   unsigned short.  The value of PYLONG_BITS_IN_DIGIT, defined either at
     14   configure time or in pyport.h, is used to decide which digit size to use.
    2015
     16   Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits'
     17   should be an unsigned integer type able to hold all integers up to
     18   PyLong_BASE*PyLong_BASE-1.  x_sub assumes that 'digit' is an unsigned type,
     19   and that overflow is handled by taking the result modulo 2**N for some N >
     20   PyLong_SHIFT.  The majority of the code doesn't care about the precise
     21   value of PyLong_SHIFT, but there are some notable exceptions:
     22
     23   - long_pow() requires that PyLong_SHIFT be divisible by 5
     24
     25   - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8
     26
     27   - long_hash() requires that PyLong_SHIFT is *strictly* less than the number
     28     of bits in an unsigned long, as do the PyLong <-> long (or unsigned long)
     29     conversion functions
     30
     31   - the long <-> size_t/Py_ssize_t conversion functions expect that
     32     PyLong_SHIFT is strictly less than the number of bits in a size_t
     33
     34   - the marshal code currently expects that PyLong_SHIFT is a multiple of 15
     35
     36  The values 15 and 30 should fit all of the above requirements, on any
     37  platform.
     38*/
     39
     40#if PYLONG_BITS_IN_DIGIT == 30
     41#if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T &&          \
     42      defined HAVE_INT64_T && defined HAVE_INT32_T)
     43#error "30-bit long digits requested, but the necessary types are not available on this platform"
     44#endif
     45typedef PY_UINT32_T digit;
     46typedef PY_INT32_T sdigit; /* signed variant of digit */
     47typedef PY_UINT64_T twodigits;
     48typedef PY_INT64_T stwodigits; /* signed variant of twodigits */
     49#define PyLong_SHIFT    30
     50#define _PyLong_DECIMAL_SHIFT   9 /* max(e such that 10**e fits in a digit) */
     51#define _PyLong_DECIMAL_BASE    ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */
     52#elif PYLONG_BITS_IN_DIGIT == 15
    2153typedef unsigned short digit;
    22 typedef unsigned int wdigit; /* digit widened to parameter size */
    23 #define BASE_TWODIGITS_TYPE long
    24 typedef unsigned BASE_TWODIGITS_TYPE twodigits;
    25 typedef BASE_TWODIGITS_TYPE stwodigits; /* signed variant of twodigits */
    26 
    27 #define PyLong_SHIFT    15
    28 #define PyLong_BASE     ((digit)1 << PyLong_SHIFT)
    29 #define PyLong_MASK     ((int)(PyLong_BASE - 1))
     54typedef short sdigit; /* signed variant of digit */
     55typedef unsigned long twodigits;
     56typedef long stwodigits; /* signed variant of twodigits */
     57#define PyLong_SHIFT    15
     58#define _PyLong_DECIMAL_SHIFT   4 /* max(e such that 10**e fits in a digit) */
     59#define _PyLong_DECIMAL_BASE    ((digit)10000) /* 10 ** DECIMAL_SHIFT */
     60#else
     61#error "PYLONG_BITS_IN_DIGIT should be 15 or 30"
     62#endif
     63#define PyLong_BASE     ((digit)1 << PyLong_SHIFT)
     64#define PyLong_MASK     ((digit)(PyLong_BASE - 1))
    3065
    3166/* b/w compatibility with Python 2.5 */
  • python/vendor/current/Include/longobject.h

    r2 r388  
    2222PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t);
    2323PyAPI_FUNC(long) PyLong_AsLong(PyObject *);
     24PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *);
    2425PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
    2526PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
    2627PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *);
     28PyAPI_FUNC(int) _PyLong_AsInt(PyObject *);
     29PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
    2730
    2831/* For use by intobject.c only */
     
    3235PyAPI_DATA(int) _PyLong_DigitValue[256];
    3336
    34 /* _PyLong_AsScaledDouble returns a double x and an exponent e such that
    35    the true value is approximately equal to x * 2**(SHIFT*e).  e is >= 0.
    36    x is 0.0 if and only if the input is 0 (in which case, e and x are both
    37    zeroes).  Overflow is impossible.  Note that the exponent returned must
    38    be multiplied by SHIFT!  There may not be enough room in an int to store
    39    e*SHIFT directly. */
    40 PyAPI_FUNC(double) _PyLong_AsScaledDouble(PyObject *vv, int *e);
     37/* _PyLong_Frexp returns a double x and an exponent e such that the
     38   true value is approximately equal to x * 2**e.  e is >= 0.  x is
     39   0.0 if and only if the input is 0 (in which case, e and x are both
     40   zeroes); otherwise, 0.5 <= abs(x) < 1.0.  On overflow, which is
     41   possible if the number of bits doesn't fit into a Py_ssize_t, sets
     42   OverflowError and returns -1.0 for x, 0 for e. */
     43PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e);
    4144
    4245PyAPI_FUNC(double) PyLong_AsDouble(PyObject *);
     
    5053PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
    5154PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
     55PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
    5256#endif /* HAVE_LONG_LONG */
    5357
  • python/vendor/current/Include/node.h

    r2 r388  
    2121                                      char *str, int lineno, int col_offset);
    2222PyAPI_FUNC(void) PyNode_Free(node *n);
     23#ifndef Py_LIMITED_API
     24Py_ssize_t _PyNode_SizeOf(node *n);
     25#endif
    2326
    2427/* Node access functions */
  • python/vendor/current/Include/object.h

    r2 r388  
    6464#ifdef Py_TRACE_REFS
    6565/* Define pointers to support a doubly-linked list of all live heap objects. */
    66 #define _PyObject_HEAD_EXTRA            \
    67         struct _object *_ob_next;       \
    68         struct _object *_ob_prev;
     66#define _PyObject_HEAD_EXTRA            \
     67    struct _object *_ob_next;           \
     68    struct _object *_ob_prev;
    6969
    7070#define _PyObject_EXTRA_INIT 0, 0,
     
    7676
    7777/* PyObject_HEAD defines the initial segment of every PyObject. */
    78 #define PyObject_HEAD                   \
    79         _PyObject_HEAD_EXTRA            \
    80         Py_ssize_t ob_refcnt;           \
    81         struct _typeobject *ob_type;
    82 
    83 #define PyObject_HEAD_INIT(type)        \
    84         _PyObject_EXTRA_INIT            \
    85         1, type,
    86 
    87 #define PyVarObject_HEAD_INIT(type, size)       \
    88         PyObject_HEAD_INIT(type) size,
     78#define PyObject_HEAD                   \
     79    _PyObject_HEAD_EXTRA                \
     80    Py_ssize_t ob_refcnt;               \
     81    struct _typeobject *ob_type;
     82
     83#define PyObject_HEAD_INIT(type)        \
     84    _PyObject_EXTRA_INIT                \
     85    1, type,
     86
     87#define PyVarObject_HEAD_INIT(type, size)       \
     88    PyObject_HEAD_INIT(type) size,
    8989
    9090/* PyObject_VAR_HEAD defines the initial segment of all variable-size
     
    9494 * not necessarily a byte count.
    9595 */
    96 #define PyObject_VAR_HEAD               \
    97         PyObject_HEAD                   \
    98         Py_ssize_t ob_size; /* Number of items in variable part */
     96#define PyObject_VAR_HEAD               \
     97    PyObject_HEAD                       \
     98    Py_ssize_t ob_size; /* Number of items in variable part */
    9999#define Py_INVALID_SIZE (Py_ssize_t)-1
    100100
     
    105105 */
    106106typedef struct _object {
    107         PyObject_HEAD
     107    PyObject_HEAD
    108108} PyObject;
    109109
    110110typedef struct {
    111         PyObject_VAR_HEAD
     111    PyObject_VAR_HEAD
    112112} PyVarObject;
    113113
    114 #define Py_REFCNT(ob)           (((PyObject*)(ob))->ob_refcnt)
    115 #define Py_TYPE(ob)             (((PyObject*)(ob))->ob_type)
    116 #define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)
     114#define Py_REFCNT(ob)           (((PyObject*)(ob))->ob_refcnt)
     115#define Py_TYPE(ob)             (((PyObject*)(ob))->ob_type)
     116#define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)
    117117
    118118/*
     
    160160typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, char **);
    161161
     162
    162163/* Py3k buffer interface */
    163 
    164164typedef struct bufferinfo {
    165         void *buf;
    166         PyObject *obj;        /* borrowed reference */
    167         Py_ssize_t len;
    168         Py_ssize_t itemsize;  /* This is Py_ssize_t so it can be
    169                                  pointed to by strides in simple case.*/
    170         int readonly;
    171         int ndim;
    172         char *format;
    173         Py_ssize_t *shape;
    174         Py_ssize_t *strides;
    175         Py_ssize_t *suboffsets;
    176         void *internal;
     165    void *buf;
     166    PyObject *obj;        /* owned reference */
     167    Py_ssize_t len;
     168    Py_ssize_t itemsize;  /* This is Py_ssize_t so it can be
     169                             pointed to by strides in simple case.*/
     170    int readonly;
     171    int ndim;
     172    char *format;
     173    Py_ssize_t *shape;
     174    Py_ssize_t *strides;
     175    Py_ssize_t *suboffsets;
     176    Py_ssize_t smalltable[2];  /* static store for shape and strides of
     177                                  mono-dimensional buffers. */
     178    void *internal;
    177179} Py_buffer;
    178180
     
    180182typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
    181183
    182         /* Flags for getting buffers */
     184    /* Flags for getting buffers */
    183185#define PyBUF_SIMPLE 0
    184186#define PyBUF_WRITABLE 0x0001
     
    216218
    217219typedef struct {
    218         /* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all
    219            arguments are guaranteed to be of the object's type (modulo
    220            coercion hacks -- i.e. if the type's coercion function
    221            returns other types, then these are allowed as well).  Numbers that
    222            have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both*
    223            arguments for proper type and implement the necessary conversions
    224            in the slot functions themselves. */
    225 
    226         binaryfunc nb_add;
    227         binaryfunc nb_subtract;
    228         binaryfunc nb_multiply;
    229         binaryfunc nb_divide;
    230         binaryfunc nb_remainder;
    231         binaryfunc nb_divmod;
    232         ternaryfunc nb_power;
    233         unaryfunc nb_negative;
    234         unaryfunc nb_positive;
    235         unaryfunc nb_absolute;
    236         inquiry nb_nonzero;
    237         unaryfunc nb_invert;
    238         binaryfunc nb_lshift;
    239         binaryfunc nb_rshift;
    240         binaryfunc nb_and;
    241         binaryfunc nb_xor;
    242         binaryfunc nb_or;
    243         coercion nb_coerce;
    244         unaryfunc nb_int;
    245         unaryfunc nb_long;
    246         unaryfunc nb_float;
    247         unaryfunc nb_oct;
    248         unaryfunc nb_hex;
    249         /* Added in release 2.0 */
    250         binaryfunc nb_inplace_add;
    251         binaryfunc nb_inplace_subtract;
    252         binaryfunc nb_inplace_multiply;
    253         binaryfunc nb_inplace_divide;
    254         binaryfunc nb_inplace_remainder;
    255         ternaryfunc nb_inplace_power;
    256         binaryfunc nb_inplace_lshift;
    257         binaryfunc nb_inplace_rshift;
    258         binaryfunc nb_inplace_and;
    259         binaryfunc nb_inplace_xor;
    260         binaryfunc nb_inplace_or;
    261 
    262         /* Added in release 2.2 */
    263         /* The following require the Py_TPFLAGS_HAVE_CLASS flag */
    264         binaryfunc nb_floor_divide;
    265         binaryfunc nb_true_divide;
    266         binaryfunc nb_inplace_floor_divide;
    267         binaryfunc nb_inplace_true_divide;
    268 
    269         /* Added in release 2.5 */
    270         unaryfunc nb_index;
     220    /* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all
     221       arguments are guaranteed to be of the object's type (modulo
     222       coercion hacks -- i.e. if the type's coercion function
     223       returns other types, then these are allowed as well).  Numbers that
     224       have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both*
     225       arguments for proper type and implement the necessary conversions
     226       in the slot functions themselves. */
     227
     228    binaryfunc nb_add;
     229    binaryfunc nb_subtract;
     230    binaryfunc nb_multiply;
     231    binaryfunc nb_divide;
     232    binaryfunc nb_remainder;
     233    binaryfunc nb_divmod;
     234    ternaryfunc nb_power;
     235    unaryfunc nb_negative;
     236    unaryfunc nb_positive;
     237    unaryfunc nb_absolute;
     238    inquiry nb_nonzero;
     239    unaryfunc nb_invert;
     240    binaryfunc nb_lshift;
     241    binaryfunc nb_rshift;
     242    binaryfunc nb_and;
     243    binaryfunc nb_xor;
     244    binaryfunc nb_or;
     245    coercion nb_coerce;
     246    unaryfunc nb_int;
     247    unaryfunc nb_long;
     248    unaryfunc nb_float;
     249    unaryfunc nb_oct;
     250    unaryfunc nb_hex;
     251    /* Added in release 2.0 */
     252    binaryfunc nb_inplace_add;
     253    binaryfunc nb_inplace_subtract;
     254    binaryfunc nb_inplace_multiply;
     255    binaryfunc nb_inplace_divide;
     256    binaryfunc nb_inplace_remainder;
     257    ternaryfunc nb_inplace_power;
     258    binaryfunc nb_inplace_lshift;
     259    binaryfunc nb_inplace_rshift;
     260    binaryfunc nb_inplace_and;
     261    binaryfunc nb_inplace_xor;
     262    binaryfunc nb_inplace_or;
     263
     264    /* Added in release 2.2 */
     265    /* The following require the Py_TPFLAGS_HAVE_CLASS flag */
     266    binaryfunc nb_floor_divide;
     267    binaryfunc nb_true_divide;
     268    binaryfunc nb_inplace_floor_divide;
     269    binaryfunc nb_inplace_true_divide;
     270
     271    /* Added in release 2.5 */
     272    unaryfunc nb_index;
    271273} PyNumberMethods;
    272274
    273275typedef struct {
    274         lenfunc sq_length;
    275         binaryfunc sq_concat;
    276         ssizeargfunc sq_repeat;
    277         ssizeargfunc sq_item;
    278         ssizessizeargfunc sq_slice;
    279         ssizeobjargproc sq_ass_item;
    280         ssizessizeobjargproc sq_ass_slice;
    281         objobjproc sq_contains;
    282         /* Added in release 2.0 */
    283         binaryfunc sq_inplace_concat;
    284         ssizeargfunc sq_inplace_repeat;
     276    lenfunc sq_length;
     277    binaryfunc sq_concat;
     278    ssizeargfunc sq_repeat;
     279    ssizeargfunc sq_item;
     280    ssizessizeargfunc sq_slice;
     281    ssizeobjargproc sq_ass_item;
     282    ssizessizeobjargproc sq_ass_slice;
     283    objobjproc sq_contains;
     284    /* Added in release 2.0 */
     285    binaryfunc sq_inplace_concat;
     286    ssizeargfunc sq_inplace_repeat;
    285287} PySequenceMethods;
    286288
    287289typedef struct {
    288         lenfunc mp_length;
    289         binaryfunc mp_subscript;
    290         objobjargproc mp_ass_subscript;
     290    lenfunc mp_length;
     291    binaryfunc mp_subscript;
     292    objobjargproc mp_ass_subscript;
    291293} PyMappingMethods;
    292294
    293295typedef struct {
    294         readbufferproc bf_getreadbuffer;
    295         writebufferproc bf_getwritebuffer;
    296         segcountproc bf_getsegcount;
    297         charbufferproc bf_getcharbuffer;
    298         getbufferproc bf_getbuffer;
    299         releasebufferproc bf_releasebuffer;
     296    readbufferproc bf_getreadbuffer;
     297    writebufferproc bf_getwritebuffer;
     298    segcountproc bf_getsegcount;
     299    charbufferproc bf_getcharbuffer;
     300    getbufferproc bf_getbuffer;
     301    releasebufferproc bf_releasebuffer;
    300302} PyBufferProcs;
    301303
     
    321323
    322324typedef struct _typeobject {
    323         PyObject_VAR_HEAD
    324         const char *tp_name; /* For printing, in format "<module>.<name>" */
    325         Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */
    326 
    327         /* Methods to implement standard operations */
    328 
    329         destructor tp_dealloc;
    330         printfunc tp_print;
    331         getattrfunc tp_getattr;
    332         setattrfunc tp_setattr;
    333         cmpfunc tp_compare;
    334         reprfunc tp_repr;
    335 
    336         /* Method suites for standard classes */
    337 
    338         PyNumberMethods *tp_as_number;
    339         PySequenceMethods *tp_as_sequence;
    340         PyMappingMethods *tp_as_mapping;
    341 
    342         /* More standard operations (here for binary compatibility) */
    343 
    344         hashfunc tp_hash;
    345         ternaryfunc tp_call;
    346         reprfunc tp_str;
    347         getattrofunc tp_getattro;
    348         setattrofunc tp_setattro;
    349 
    350         /* Functions to access object as input/output buffer */
    351         PyBufferProcs *tp_as_buffer;
    352 
    353         /* Flags to define presence of optional/expanded features */
    354         long tp_flags;
    355 
    356         const char *tp_doc; /* Documentation string */
    357 
    358         /* Assigned meaning in release 2.0 */
    359         /* call function for all accessible objects */
    360         traverseproc tp_traverse;
    361 
    362         /* delete references to contained objects */
    363         inquiry tp_clear;
    364 
    365         /* Assigned meaning in release 2.1 */
    366         /* rich comparisons */
    367         richcmpfunc tp_richcompare;
    368 
    369         /* weak reference enabler */
    370         Py_ssize_t tp_weaklistoffset;
    371 
    372         /* Added in release 2.2 */
    373         /* Iterators */
    374         getiterfunc tp_iter;
    375         iternextfunc tp_iternext;
    376 
    377         /* Attribute descriptor and subclassing stuff */
    378         struct PyMethodDef *tp_methods;
    379         struct PyMemberDef *tp_members;
    380         struct PyGetSetDef *tp_getset;
    381         struct _typeobject *tp_base;
    382         PyObject *tp_dict;
    383         descrgetfunc tp_descr_get;
    384         descrsetfunc tp_descr_set;
    385         Py_ssize_t tp_dictoffset;
    386         initproc tp_init;
    387         allocfunc tp_alloc;
    388         newfunc tp_new;
    389         freefunc tp_free; /* Low-level free-memory routine */
    390         inquiry tp_is_gc; /* For PyObject_IS_GC */
    391         PyObject *tp_bases;
    392         PyObject *tp_mro; /* method resolution order */
    393         PyObject *tp_cache;
    394         PyObject *tp_subclasses;
    395         PyObject *tp_weaklist;
    396         destructor tp_del;
    397 
    398         /* Type attribute cache version tag. Added in version 2.6 */
    399         unsigned int tp_version_tag;
     325    PyObject_VAR_HEAD
     326    const char *tp_name; /* For printing, in format "<module>.<name>" */
     327    Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */
     328
     329    /* Methods to implement standard operations */
     330
     331    destructor tp_dealloc;
     332    printfunc tp_print;
     333    getattrfunc tp_getattr;
     334    setattrfunc tp_setattr;
     335    cmpfunc tp_compare;
     336    reprfunc tp_repr;
     337
     338    /* Method suites for standard classes */
     339
     340    PyNumberMethods *tp_as_number;
     341    PySequenceMethods *tp_as_sequence;
     342    PyMappingMethods *tp_as_mapping;
     343
     344    /* More standard operations (here for binary compatibility) */
     345
     346    hashfunc tp_hash;
     347    ternaryfunc tp_call;
     348    reprfunc tp_str;
     349    getattrofunc tp_getattro;
     350    setattrofunc tp_setattro;
     351
     352    /* Functions to access object as input/output buffer */
     353    PyBufferProcs *tp_as_buffer;
     354
     355    /* Flags to define presence of optional/expanded features */
     356    long tp_flags;
     357
     358    const char *tp_doc; /* Documentation string */
     359
     360    /* Assigned meaning in release 2.0 */
     361    /* call function for all accessible objects */
     362    traverseproc tp_traverse;
     363
     364    /* delete references to contained objects */
     365    inquiry tp_clear;
     366
     367    /* Assigned meaning in release 2.1 */
     368    /* rich comparisons */
     369    richcmpfunc tp_richcompare;
     370
     371    /* weak reference enabler */
     372    Py_ssize_t tp_weaklistoffset;
     373
     374    /* Added in release 2.2 */
     375    /* Iterators */
     376    getiterfunc tp_iter;
     377    iternextfunc tp_iternext;
     378
     379    /* Attribute descriptor and subclassing stuff */
     380    struct PyMethodDef *tp_methods;
     381    struct PyMemberDef *tp_members;
     382    struct PyGetSetDef *tp_getset;
     383    struct _typeobject *tp_base;
     384    PyObject *tp_dict;
     385    descrgetfunc tp_descr_get;
     386    descrsetfunc tp_descr_set;
     387    Py_ssize_t tp_dictoffset;
     388    initproc tp_init;
     389    allocfunc tp_alloc;
     390    newfunc tp_new;
     391    freefunc tp_free; /* Low-level free-memory routine */
     392    inquiry tp_is_gc; /* For PyObject_IS_GC */
     393    PyObject *tp_bases;
     394    PyObject *tp_mro; /* method resolution order */
     395    PyObject *tp_cache;
     396    PyObject *tp_subclasses;
     397    PyObject *tp_weaklist;
     398    destructor tp_del;
     399
     400    /* Type attribute cache version tag. Added in version 2.6 */
     401    unsigned int tp_version_tag;
    400402
    401403#ifdef COUNT_ALLOCS
    402         /* these must be last and never explicitly initialized */
    403         Py_ssize_t tp_allocs;
    404         Py_ssize_t tp_frees;
    405         Py_ssize_t tp_maxalloc;
    406         struct _typeobject *tp_prev;
    407         struct _typeobject *tp_next;
     404    /* these must be last and never explicitly initialized */
     405    Py_ssize_t tp_allocs;
     406    Py_ssize_t tp_frees;
     407    Py_ssize_t tp_maxalloc;
     408    struct _typeobject *tp_prev;
     409    struct _typeobject *tp_next;
    408410#endif
    409411} PyTypeObject;
     
    412414/* The *real* layout of a type object when allocated on the heap */
    413415typedef struct _heaptypeobject {
    414         /* Note: there's a dependency on the order of these members
    415            in slotptr() in typeobject.c . */
    416         PyTypeObject ht_type;
    417         PyNumberMethods as_number;
    418         PyMappingMethods as_mapping;
    419         PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
    420                                           so that the mapping wins when both
    421                                           the mapping and the sequence define
    422                                           a given operator (e.g. __getitem__).
    423                                           see add_operators() in typeobject.c . */
    424         PyBufferProcs as_buffer;
    425         PyObject *ht_name, *ht_slots;
    426         /* here are optional user slots, followed by the members. */
     416    /* Note: there's a dependency on the order of these members
     417       in slotptr() in typeobject.c . */
     418    PyTypeObject ht_type;
     419    PyNumberMethods as_number;
     420    PyMappingMethods as_mapping;
     421    PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
     422                                      so that the mapping wins when both
     423                                      the mapping and the sequence define
     424                                      a given operator (e.g. __getitem__).
     425                                      see add_operators() in typeobject.c . */
     426    PyBufferProcs as_buffer;
     427    PyObject *ht_name, *ht_slots;
     428    /* here are optional user slots, followed by the members. */
    427429} PyHeapTypeObject;
    428430
     
    435437PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
    436438#define PyObject_TypeCheck(ob, tp) \
    437         (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
     439    (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
    438440
    439441PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
     
    442444
    443445#define PyType_Check(op) \
    444         PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
     446    PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
    445447#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type)
    446448
     
    448450PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t);
    449451PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *,
    450                                                PyObject *, PyObject *);
     452                                               PyObject *, PyObject *);
    451453PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
     454PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, char *, PyObject **);
    452455PyAPI_FUNC(unsigned int) PyType_ClearCache(void);
    453456PyAPI_FUNC(void) PyType_Modified(PyTypeObject *);
     
    474477PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *);
    475478PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *);
     479PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *);
    476480PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
    477481PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *,
    478                                               PyObject *, PyObject *);
     482                                              PyObject *, PyObject *);
    479483PyAPI_FUNC(long) PyObject_Hash(PyObject *);
    480484PyAPI_FUNC(long) PyObject_HashNotImplemented(PyObject *);
     
    489493/* A slot function whose address we need to compare */
    490494extern int _PyObject_SlotCompare(PyObject *, PyObject *);
     495/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes
     496   dict as the last parameter. */
     497PyAPI_FUNC(PyObject *)
     498_PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *);
     499PyAPI_FUNC(int)
     500_PyObject_GenericSetAttrWithDict(PyObject *, PyObject *,
     501                                 PyObject *, PyObject *);
    491502
    492503
     
    507518PyAPI_FUNC(long) _Py_HashPointer(void*);
    508519
     520typedef struct {
     521    long prefix;
     522    long suffix;
     523} _Py_HashSecret_t;
     524PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret;
     525
     526#ifdef Py_DEBUG
     527PyAPI_DATA(int) _Py_HashSecret_Initialized;
     528#endif
     529
    509530/* Helper for passing objects to printf and the like */
    510531#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj))
    511532
    512533/* Flag bits for printing: */
    513 #define Py_PRINT_RAW    1       /* No string quotes etc. */
     534#define Py_PRINT_RAW    1       /* No string quotes etc. */
    514535
    515536/*
     
    604625
    605626/* These flags are used to determine if a type is a subclass. */
    606 #define Py_TPFLAGS_INT_SUBCLASS         (1L<<23)
    607 #define Py_TPFLAGS_LONG_SUBCLASS        (1L<<24)
    608 #define Py_TPFLAGS_LIST_SUBCLASS        (1L<<25)
    609 #define Py_TPFLAGS_TUPLE_SUBCLASS       (1L<<26)
    610 #define Py_TPFLAGS_STRING_SUBCLASS      (1L<<27)
    611 #define Py_TPFLAGS_UNICODE_SUBCLASS     (1L<<28)
    612 #define Py_TPFLAGS_DICT_SUBCLASS        (1L<<29)
    613 #define Py_TPFLAGS_BASE_EXC_SUBCLASS    (1L<<30)
    614 #define Py_TPFLAGS_TYPE_SUBCLASS        (1L<<31)
     627#define Py_TPFLAGS_INT_SUBCLASS         (1L<<23)
     628#define Py_TPFLAGS_LONG_SUBCLASS        (1L<<24)
     629#define Py_TPFLAGS_LIST_SUBCLASS        (1L<<25)
     630#define Py_TPFLAGS_TUPLE_SUBCLASS       (1L<<26)
     631#define Py_TPFLAGS_STRING_SUBCLASS      (1L<<27)
     632#define Py_TPFLAGS_UNICODE_SUBCLASS     (1L<<28)
     633#define Py_TPFLAGS_DICT_SUBCLASS        (1L<<29)
     634#define Py_TPFLAGS_BASE_EXC_SUBCLASS    (1L<<30)
     635#define Py_TPFLAGS_TYPE_SUBCLASS        (1L<<31)
    615636
    616637#define Py_TPFLAGS_DEFAULT_EXTERNAL ( \
    617                              Py_TPFLAGS_HAVE_GETCHARBUFFER | \
    618                              Py_TPFLAGS_HAVE_SEQUENCE_IN | \
    619                              Py_TPFLAGS_HAVE_INPLACEOPS | \
    620                              Py_TPFLAGS_HAVE_RICHCOMPARE | \
    621                              Py_TPFLAGS_HAVE_WEAKREFS | \
    622                              Py_TPFLAGS_HAVE_ITER | \
    623                              Py_TPFLAGS_HAVE_CLASS | \
    624                              Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
    625                              Py_TPFLAGS_HAVE_INDEX | \
    626                              0)
     638                 Py_TPFLAGS_HAVE_GETCHARBUFFER | \
     639                 Py_TPFLAGS_HAVE_SEQUENCE_IN | \
     640                 Py_TPFLAGS_HAVE_INPLACEOPS | \
     641                 Py_TPFLAGS_HAVE_RICHCOMPARE | \
     642                 Py_TPFLAGS_HAVE_WEAKREFS | \
     643                 Py_TPFLAGS_HAVE_ITER | \
     644                 Py_TPFLAGS_HAVE_CLASS | \
     645                 Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
     646                 Py_TPFLAGS_HAVE_INDEX | \
     647                 0)
    627648#define Py_TPFLAGS_DEFAULT_CORE (Py_TPFLAGS_DEFAULT_EXTERNAL | \
    628                                  Py_TPFLAGS_HAVE_VERSION_TAG)
     649                 Py_TPFLAGS_HAVE_VERSION_TAG)
    629650
    630651#ifdef Py_BUILD_CORE
     
    684705PyAPI_DATA(Py_ssize_t) _Py_RefTotal;
    685706PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname,
    686                                             int lineno, PyObject *op);
     707                                            int lineno, PyObject *op);
    687708PyAPI_FUNC(PyObject *) _PyDict_Dummy(void);
    688709PyAPI_FUNC(PyObject *) _PySet_Dummy(void);
    689710PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
    690 #define _Py_INC_REFTOTAL        _Py_RefTotal++
    691 #define _Py_DEC_REFTOTAL        _Py_RefTotal--
    692 #define _Py_REF_DEBUG_COMMA     ,
    693 #define _Py_CHECK_REFCNT(OP)                                    \
    694 {       if (((PyObject*)OP)->ob_refcnt < 0)                             \
    695                 _Py_NegativeRefcount(__FILE__, __LINE__,        \
    696                                      (PyObject *)(OP));         \
     711#define _Py_INC_REFTOTAL        _Py_RefTotal++
     712#define _Py_DEC_REFTOTAL        _Py_RefTotal--
     713#define _Py_REF_DEBUG_COMMA     ,
     714#define _Py_CHECK_REFCNT(OP)                                    \
     715{       if (((PyObject*)OP)->ob_refcnt < 0)                             \
     716                _Py_NegativeRefcount(__FILE__, __LINE__,        \
     717                                     (PyObject *)(OP));         \
    697718}
    698719#else
     
    700721#define _Py_DEC_REFTOTAL
    701722#define _Py_REF_DEBUG_COMMA
    702 #define _Py_CHECK_REFCNT(OP)    /* a semicolon */;
     723#define _Py_CHECK_REFCNT(OP)    /* a semicolon */;
    703724#endif /* Py_REF_DEBUG */
    704725
     
    706727PyAPI_FUNC(void) inc_count(PyTypeObject *);
    707728PyAPI_FUNC(void) dec_count(PyTypeObject *);
    708 #define _Py_INC_TPALLOCS(OP)    inc_count(Py_TYPE(OP))
    709 #define _Py_INC_TPFREES(OP)     dec_count(Py_TYPE(OP))
    710 #define _Py_DEC_TPFREES(OP)     Py_TYPE(OP)->tp_frees--
    711 #define _Py_COUNT_ALLOCS_COMMA  ,
     729#define _Py_INC_TPALLOCS(OP)    inc_count(Py_TYPE(OP))
     730#define _Py_INC_TPFREES(OP)     dec_count(Py_TYPE(OP))
     731#define _Py_DEC_TPFREES(OP)     Py_TYPE(OP)->tp_frees--
     732#define _Py_COUNT_ALLOCS_COMMA  ,
    712733#else
    713734#define _Py_INC_TPALLOCS(OP)
     
    730751 * inline.
    731752 */
    732 #define _Py_NewReference(op) (                          \
    733         _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA     \
    734         _Py_INC_REFTOTAL  _Py_REF_DEBUG_COMMA           \
    735         Py_REFCNT(op) = 1)
     753#define _Py_NewReference(op) (                          \
     754    _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA         \
     755    _Py_INC_REFTOTAL  _Py_REF_DEBUG_COMMA               \
     756    Py_REFCNT(op) = 1)
    736757
    737758#define _Py_ForgetReference(op) _Py_INC_TPFREES(op)
    738759
    739 #define _Py_Dealloc(op) (                               \
    740         _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA      \
    741         (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op)))
     760#define _Py_Dealloc(op) (                               \
     761    _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA          \
     762    (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op)))
    742763#endif /* !Py_TRACE_REFS */
    743764
    744 #define Py_INCREF(op) (                         \
    745         _Py_INC_REFTOTAL  _Py_REF_DEBUG_COMMA   \
    746         ((PyObject*)(op))->ob_refcnt++)
    747 
    748 #define Py_DECREF(op)                                   \
    749         if (_Py_DEC_REFTOTAL  _Py_REF_DEBUG_COMMA       \
    750             --((PyObject*)(op))->ob_refcnt != 0)                \
    751                 _Py_CHECK_REFCNT(op)                    \
    752         else                                            \
    753                 _Py_Dealloc((PyObject *)(op))
     765#define Py_INCREF(op) (                         \
     766    _Py_INC_REFTOTAL  _Py_REF_DEBUG_COMMA       \
     767    ((PyObject*)(op))->ob_refcnt++)
     768
     769#define Py_DECREF(op)                                   \
     770    do {                                                \
     771        if (_Py_DEC_REFTOTAL  _Py_REF_DEBUG_COMMA       \
     772        --((PyObject*)(op))->ob_refcnt != 0)            \
     773            _Py_CHECK_REFCNT(op)                        \
     774        else                                            \
     775        _Py_Dealloc((PyObject *)(op));                  \
     776    } while (0)
    754777
    755778/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
     
    787810 * to use Py_CLEAR() even if you can't think of a reason for why you need to.
    788811 */
    789 #define Py_CLEAR(op)                            \
    790         do {                                    \
    791                 if (op) {                       \
    792                         PyObject *_py_tmp = (PyObject *)(op);   \
    793                         (op) = NULL;            \
    794                         Py_DECREF(_py_tmp);     \
    795                 }                               \
    796         } while (0)
     812#define Py_CLEAR(op)                            \
     813    do {                                        \
     814        if (op) {                               \
     815            PyObject *_py_tmp = (PyObject *)(op);               \
     816            (op) = NULL;                        \
     817            Py_DECREF(_py_tmp);                 \
     818        }                                       \
     819    } while (0)
    797820
    798821/* Macros to use in case the object pointer may be NULL: */
    799 #define Py_XINCREF(op) if ((op) == NULL) ; else Py_INCREF(op)
    800 #define Py_XDECREF(op) if ((op) == NULL) ; else Py_DECREF(op)
     822#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0)
     823#define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0)
    801824
    802825/*
     
    921944mytype_dealloc(mytype *p)
    922945{
    923         ... declarations go here ...
    924 
    925         PyObject_GC_UnTrack(p);    // must untrack first
    926         Py_TRASHCAN_SAFE_BEGIN(p)
    927         ... The body of the deallocator goes here, including all calls ...
    928         ... to Py_DECREF on contained objects.                         ...
    929         Py_TRASHCAN_SAFE_END(p)
     946    ... declarations go here ...
     947
     948    PyObject_GC_UnTrack(p);        // must untrack first
     949    Py_TRASHCAN_SAFE_BEGIN(p)
     950    ... The body of the deallocator goes here, including all calls ...
     951    ... to Py_DECREF on contained objects.                         ...
     952    Py_TRASHCAN_SAFE_END(p)
    930953}
    931954
     
    949972*/
    950973
     974/* This is the old private API, invoked by the macros before 2.7.4.
     975   Kept for binary compatibility of extensions. */
    951976PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*);
    952977PyAPI_FUNC(void) _PyTrash_destroy_chain(void);
     
    954979PyAPI_DATA(PyObject *) _PyTrash_delete_later;
    955980
     981/* The new thread-safe private API, invoked by the macros below. */
     982PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*);
     983PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void);
     984
    956985#define PyTrash_UNWIND_LEVEL 50
    957986
     987/* Note the workaround for when the thread state is NULL (issue #17703) */
    958988#define Py_TRASHCAN_SAFE_BEGIN(op) \
    959         if (_PyTrash_delete_nesting < PyTrash_UNWIND_LEVEL) { \
    960                 ++_PyTrash_delete_nesting;
    961                 /* The body of the deallocator is here. */
     989    do { \
     990        PyThreadState *_tstate = PyThreadState_GET(); \
     991        if (!_tstate || \
     992            _tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \
     993            if (_tstate) \
     994                ++_tstate->trash_delete_nesting;
     995            /* The body of the deallocator is here. */
    962996#define Py_TRASHCAN_SAFE_END(op) \
    963                 --_PyTrash_delete_nesting; \
    964                 if (_PyTrash_delete_later && _PyTrash_delete_nesting <= 0) \
    965                         _PyTrash_destroy_chain(); \
    966         } \
    967         else \
    968                 _PyTrash_deposit_object((PyObject*)op);
     997            if (_tstate) { \
     998                --_tstate->trash_delete_nesting; \
     999                if (_tstate->trash_delete_later \
     1000                    && _tstate->trash_delete_nesting <= 0) \
     1001                    _PyTrash_thread_destroy_chain(); \
     1002            } \
     1003        } \
     1004        else \
     1005            _PyTrash_thread_deposit_object((PyObject*)op); \
     1006    } while (0);
    9691007
    9701008#ifdef __cplusplus
  • python/vendor/current/Include/objimpl.h

    r2 r388  
    102102/* Macros */
    103103#ifdef WITH_PYMALLOC
    104 #ifdef PYMALLOC_DEBUG   /* WITH_PYMALLOC && PYMALLOC_DEBUG */
     104#ifdef PYMALLOC_DEBUG   /* WITH_PYMALLOC && PYMALLOC_DEBUG */
    105105PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes);
    106106PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes);
     
    109109PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p);
    110110PyAPI_FUNC(void) _PyObject_DebugMallocStats(void);
    111 #define PyObject_MALLOC         _PyObject_DebugMalloc
    112 #define PyObject_Malloc         _PyObject_DebugMalloc
    113 #define PyObject_REALLOC        _PyObject_DebugRealloc
    114 #define PyObject_Realloc        _PyObject_DebugRealloc
    115 #define PyObject_FREE           _PyObject_DebugFree
    116 #define PyObject_Free           _PyObject_DebugFree
    117 
    118 #else   /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */
    119 #define PyObject_MALLOC         PyObject_Malloc
    120 #define PyObject_REALLOC        PyObject_Realloc
    121 #define PyObject_FREE           PyObject_Free
     111PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes);
     112PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes);
     113PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p);
     114PyAPI_FUNC(void) _PyObject_DebugCheckAddressApi(char api, const void *p);
     115PyAPI_FUNC(void *) _PyMem_DebugMalloc(size_t nbytes);
     116PyAPI_FUNC(void *) _PyMem_DebugRealloc(void *p, size_t nbytes);
     117PyAPI_FUNC(void) _PyMem_DebugFree(void *p);
     118#define PyObject_MALLOC         _PyObject_DebugMalloc
     119#define PyObject_Malloc         _PyObject_DebugMalloc
     120#define PyObject_REALLOC        _PyObject_DebugRealloc
     121#define PyObject_Realloc        _PyObject_DebugRealloc
     122#define PyObject_FREE           _PyObject_DebugFree
     123#define PyObject_Free           _PyObject_DebugFree
     124
     125#else   /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */
     126#define PyObject_MALLOC         PyObject_Malloc
     127#define PyObject_REALLOC        PyObject_Realloc
     128#define PyObject_FREE           PyObject_Free
    122129#endif
    123130
    124 #else   /* ! WITH_PYMALLOC */
    125 #define PyObject_MALLOC         PyMem_MALLOC
    126 #define PyObject_REALLOC        PyMem_REALLOC
    127 #define PyObject_FREE           PyMem_FREE
    128 
    129 #endif  /* WITH_PYMALLOC */
    130 
    131 #define PyObject_Del            PyObject_Free
    132 #define PyObject_DEL            PyObject_FREE
     131#else   /* ! WITH_PYMALLOC */
     132#define PyObject_MALLOC         PyMem_MALLOC
     133#define PyObject_REALLOC        PyMem_REALLOC
     134#define PyObject_FREE           PyMem_FREE
     135
     136#endif  /* WITH_PYMALLOC */
     137
     138#define PyObject_Del            PyObject_Free
     139#define PyObject_DEL            PyObject_FREE
    133140
    134141/* for source compatibility with 2.2 */
    135 #define _PyObject_Del           PyObject_Free
     142#define _PyObject_Del           PyObject_Free
    136143
    137144/*
     
    148155
    149156#define PyObject_New(type, typeobj) \
    150                 ( (type *) _PyObject_New(typeobj) )
     157                ( (type *) _PyObject_New(typeobj) )
    151158#define PyObject_NewVar(type, typeobj, n) \
    152                 ( (type *) _PyObject_NewVar((typeobj), (n)) )
     159                ( (type *) _PyObject_NewVar((typeobj), (n)) )
    153160
    154161/* Macros trading binary compatibility for speed. See also pymem.h.
    155162   Note that these macros expect non-NULL object pointers.*/
    156163#define PyObject_INIT(op, typeobj) \
    157         ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
     164    ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
    158165#define PyObject_INIT_VAR(op, typeobj, size) \
    159         ( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) )
     166    ( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) )
    160167
    161168#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
     
    175182#endif
    176183
    177 #define _PyObject_VAR_SIZE(typeobj, nitems)     \
    178         (size_t)                                \
    179         ( ( (typeobj)->tp_basicsize +           \
    180             (nitems)*(typeobj)->tp_itemsize +   \
    181             (SIZEOF_VOID_P - 1)                 \
    182           ) & ~(SIZEOF_VOID_P - 1)              \
    183         )
     184#define _PyObject_VAR_SIZE(typeobj, nitems)     \
     185    (size_t)                                    \
     186    ( ( (typeobj)->tp_basicsize +               \
     187        (nitems)*(typeobj)->tp_itemsize +       \
     188        (SIZEOF_VOID_P - 1)                     \
     189      ) & ~(SIZEOF_VOID_P - 1)                  \
     190    )
    184191
    185192#define PyObject_NEW(type, typeobj) \
    186193( (type *) PyObject_Init( \
    187         (PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) )
     194    (PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) )
    188195
    189196#define PyObject_NEW_VAR(type, typeobj, n) \
     
    197204       1) the actual allocation of the object storage;
    198205       2) the initialization of the Python specific fields
    199           in this storage with PyObject_{Init, InitVar}.
     206      in this storage with PyObject_{Init, InitVar}.
    200207
    201208   PyObject *
     
    206213       op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct));
    207214       if (op == NULL)
    208            return PyErr_NoMemory();
     215       return PyErr_NoMemory();
    209216
    210217       PyObject_Init(op, &YourTypeStruct);
     
    233240/* Test if an object has a GC head */
    234241#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \
    235         (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o)))
     242    (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o)))
    236243
    237244PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
    238245#define PyObject_GC_Resize(type, op, n) \
    239                 ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) )
     246                ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) )
    240247
    241248/* for source compatibility with 2.2 */
     
    244251/* GC information is stored BEFORE the object structure. */
    245252typedef union _gc_head {
    246         struct {
    247                 union _gc_head *gc_next;
    248                 union _gc_head *gc_prev;
    249                 Py_ssize_t gc_refs;
    250         } gc;
    251         long double dummy;  /* force worst-case alignment */
     253    struct {
     254        union _gc_head *gc_next;
     255        union _gc_head *gc_prev;
     256        Py_ssize_t gc_refs;
     257    } gc;
     258    long double dummy;  /* force worst-case alignment */
    252259} PyGC_Head;
    253260
     
    256263#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1)
    257264
    258 #define _PyGC_REFS_UNTRACKED                    (-2)
    259 #define _PyGC_REFS_REACHABLE                    (-3)
    260 #define _PyGC_REFS_TENTATIVELY_UNREACHABLE      (-4)
     265#define _PyGC_REFS_UNTRACKED                    (-2)
     266#define _PyGC_REFS_REACHABLE                    (-3)
     267#define _PyGC_REFS_TENTATIVELY_UNREACHABLE      (-4)
    261268
    262269/* Tell the GC to track this object.  NB: While the object is tracked the
    263270 * collector it must be safe to call the ob_traverse method. */
    264271#define _PyObject_GC_TRACK(o) do { \
    265         PyGC_Head *g = _Py_AS_GC(o); \
    266         if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \
    267                 Py_FatalError("GC object already tracked"); \
    268         g->gc.gc_refs = _PyGC_REFS_REACHABLE; \
    269         g->gc.gc_next = _PyGC_generation0; \
    270         g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \
    271         g->gc.gc_prev->gc.gc_next = g; \
    272         _PyGC_generation0->gc.gc_prev = g; \
     272    PyGC_Head *g = _Py_AS_GC(o); \
     273    if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \
     274        Py_FatalError("GC object already tracked"); \
     275    g->gc.gc_refs = _PyGC_REFS_REACHABLE; \
     276    g->gc.gc_next = _PyGC_generation0; \
     277    g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \
     278    g->gc.gc_prev->gc.gc_next = g; \
     279    _PyGC_generation0->gc.gc_prev = g; \
    273280    } while (0);
    274281
     
    278285 */
    279286#define _PyObject_GC_UNTRACK(o) do { \
    280         PyGC_Head *g = _Py_AS_GC(o); \
    281         assert(g->gc.gc_refs != _PyGC_REFS_UNTRACKED); \
    282         g->gc.gc_refs = _PyGC_REFS_UNTRACKED; \
    283         g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \
    284         g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \
    285         g->gc.gc_next = NULL; \
     287    PyGC_Head *g = _Py_AS_GC(o); \
     288    assert(g->gc.gc_refs != _PyGC_REFS_UNTRACKED); \
     289    g->gc.gc_refs = _PyGC_REFS_UNTRACKED; \
     290    g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \
     291    g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \
     292    g->gc.gc_next = NULL; \
    286293    } while (0);
     294
     295/* True if the object is currently tracked by the GC. */
     296#define _PyObject_GC_IS_TRACKED(o) \
     297    ((_Py_AS_GC(o))->gc.gc_refs != _PyGC_REFS_UNTRACKED)
     298
     299/* True if the object may be tracked by the GC in the future, or already is.
     300   This can be useful to implement some optimizations. */
     301#define _PyObject_GC_MAY_BE_TRACKED(obj) \
     302    (PyObject_IS_GC(obj) && \
     303        (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj)))
     304
    287305
    288306PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t);
     
    294312
    295313#define PyObject_GC_New(type, typeobj) \
    296                 ( (type *) _PyObject_GC_New(typeobj) )
     314                ( (type *) _PyObject_GC_New(typeobj) )
    297315#define PyObject_GC_NewVar(type, typeobj, n) \
    298                 ( (type *) _PyObject_GC_NewVar((typeobj), (n)) )
     316                ( (type *) _PyObject_GC_NewVar((typeobj), (n)) )
    299317
    300318
     
    304322 * looking as much alike as possible.
    305323 */
    306 #define Py_VISIT(op)                                                    \
    307         do {                                                            \
    308                 if (op) {                                               \
    309                         int vret = visit((PyObject *)(op), arg);        \
    310                         if (vret)                                       \
    311                                 return vret;                            \
    312                 }                                                       \
    313         } while (0)
     324#define Py_VISIT(op)                                                    \
     325    do {                                                                \
     326        if (op) {                                                       \
     327            int vret = visit((PyObject *)(op), arg);                    \
     328            if (vret)                                                   \
     329                return vret;                                            \
     330        }                                                               \
     331    } while (0)
    314332
    315333/* This is here for the sake of backwards compatibility.  Extensions that
     
    325343/* Test if a type supports weak references */
    326344#define PyType_SUPPORTS_WEAKREFS(t) \
    327         (PyType_HasFeature((t), Py_TPFLAGS_HAVE_WEAKREFS) \
    328          && ((t)->tp_weaklistoffset > 0))
     345    (PyType_HasFeature((t), Py_TPFLAGS_HAVE_WEAKREFS) \
     346     && ((t)->tp_weaklistoffset > 0))
    329347
    330348#define PyObject_GET_WEAKREFS_LISTPTR(o) \
    331         ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset))
     349    ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset))
    332350
    333351#ifdef __cplusplus
  • python/vendor/current/Include/opcode.h

    r2 r388  
    2323#define UNARY_INVERT    15
    2424
    25 #define LIST_APPEND     18
    2625#define BINARY_POWER    19
    2726
     
    9089#define UNPACK_SEQUENCE 92      /* Number of sequence items */
    9190#define FOR_ITER        93
     91#define LIST_APPEND     94
    9292
    9393#define STORE_ATTR      95      /* Index in name list */
     
    100100#define BUILD_TUPLE     102     /* Number of tuple items */
    101101#define BUILD_LIST      103     /* Number of list items */
    102 #define BUILD_MAP       104     /* Always zero for now */
    103 #define LOAD_ATTR       105     /* Index in name list */
    104 #define COMPARE_OP      106     /* Comparison operator */
    105 #define IMPORT_NAME     107     /* Index in name list */
    106 #define IMPORT_FROM     108     /* Index in name list */
     102#define BUILD_SET       104     /* Number of set items */
     103#define BUILD_MAP       105     /* Always zero for now */
     104#define LOAD_ATTR       106     /* Index in name list */
     105#define COMPARE_OP      107     /* Comparison operator */
     106#define IMPORT_NAME     108     /* Index in name list */
     107#define IMPORT_FROM     109     /* Index in name list */
     108#define JUMP_FORWARD    110     /* Number of bytes to skip */
    107109
    108 #define JUMP_FORWARD    110     /* Number of bytes to skip */
    109 #define JUMP_IF_FALSE   111     /* "" */
    110 #define JUMP_IF_TRUE    112     /* "" */
    111 #define JUMP_ABSOLUTE   113     /* Target byte offset from beginning of code */
     110#define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning
     111                                    of code */
     112#define JUMP_IF_TRUE_OR_POP 112 /* "" */
     113#define JUMP_ABSOLUTE   113     /* "" */
     114#define POP_JUMP_IF_FALSE 114   /* "" */
     115#define POP_JUMP_IF_TRUE 115    /* "" */
    112116
    113117#define LOAD_GLOBAL     116     /* Index in name list */
     
    139143#define CALL_FUNCTION_VAR_KW       142  /* #args + (#kwargs<<8) */
    140144
     145#define SETUP_WITH 143
     146
    141147/* Support for opargs more than 16 bits long */
    142 #define EXTENDED_ARG  143
     148#define EXTENDED_ARG  145
     149
     150#define SET_ADD         146
     151#define MAP_ADD         147
    143152
    144153
  • python/vendor/current/Include/osdefs.h

    r2 r388  
    3737
    3838/* Max pathname length */
     39#ifdef __hpux
     40#include <sys/param.h>
     41#include <limits.h>
     42#ifndef PATH_MAX
     43#define PATH_MAX MAXPATHLEN
     44#endif
     45#endif
     46
    3947#ifndef MAXPATHLEN
    4048#if defined(PATH_MAX) && PATH_MAX > 1024
  • python/vendor/current/Include/patchlevel.h

    r2 r388  
    77
    88   When the major or minor version changes, the VERSION variable in
    9    configure.in must also be changed.
     9   configure.ac must also be changed.
    1010
    1111   There is also (independent) API version information in modsupport.h.
     
    2222/*--start constants--*/
    2323#define PY_MAJOR_VERSION        2
    24 #define PY_MINOR_VERSION        6
    25 #define PY_MICRO_VERSION        5
     24#define PY_MINOR_VERSION        7
     25#define PY_MICRO_VERSION        6
    2626#define PY_RELEASE_LEVEL        PY_RELEASE_LEVEL_FINAL
    2727#define PY_RELEASE_SERIAL       0
    2828
    2929/* Version as a string */
    30 #define PY_VERSION              "2.6.5"
     30#define PY_VERSION              "2.7.6"
    3131/*--end constants--*/
    3232
    33 /* Subversion Revision number of this file (not of the repository) */
    34 #define PY_PATCHLEVEL_REVISION  "$Revision: 79063 $"
     33/* Subversion Revision number of this file (not of the repository). Empty
     34   since Mercurial migration. */
     35#define PY_PATCHLEVEL_REVISION  ""
    3536
    3637/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
  • python/vendor/current/Include/py_curses.h

    r2 r388  
    8181#define PyCursesWindow_Check(v)  (Py_TYPE(v) == &PyCursesWindow_Type)
    8282
     83#define PyCurses_CAPSULE_NAME "_curses._C_API"
     84
     85
    8386#ifdef CURSES_MODULE
    8487/* This section is used when compiling _cursesmodule.c */
     
    9598
    9699#define import_curses() \
    97 { \
    98   PyObject *module = PyImport_ImportModuleNoBlock("_curses"); \
    99   if (module != NULL) { \
    100     PyObject *module_dict = PyModule_GetDict(module); \
    101     PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \
    102     if (PyCObject_Check(c_api_object)) { \
    103       PyCurses_API = (void **)PyCObject_AsVoidPtr(c_api_object); \
    104     } \
    105   } \
    106 }
     100    PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1);
     101
    107102#endif
    108103
  • python/vendor/current/Include/pydebug.h

    r2 r388  
    2727/* Warn about 3.x issues */
    2828PyAPI_DATA(int) Py_Py3kWarningFlag;
     29PyAPI_DATA(int) Py_HashRandomizationFlag;
    2930
    3031/* this is a wrapper around getenv() that pays attention to
  • python/vendor/current/Include/pyerrors.h

    r2 r388  
    9595/* */
    9696
    97 #define PyExceptionClass_Check(x)                                       \
    98         (PyClass_Check((x)) || (PyType_Check((x)) &&                    \
    99           PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)))
    100 
    101 #define PyExceptionInstance_Check(x)                    \
    102         (PyInstance_Check((x)) ||                       \
    103         PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS))
    104 
    105 #define PyExceptionClass_Name(x)                                   \
    106         (PyClass_Check((x))                                        \
    107          ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name)      \
    108         : (char *)(((PyTypeObject*)(x))->tp_name))
    109 
    110 #define PyExceptionInstance_Class(x)                                    \
    111         ((PyInstance_Check((x))                                         \
    112           ? (PyObject*)((PyInstanceObject*)(x))->in_class               \
    113           : (PyObject*)((x)->ob_type)))
    114 
    115        
     97#define PyExceptionClass_Check(x)                                       \
     98    (PyClass_Check((x)) || (PyType_Check((x)) &&                        \
     99      PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)))
     100
     101#define PyExceptionInstance_Check(x)                    \
     102    (PyInstance_Check((x)) ||                           \
     103    PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS))
     104
     105#define PyExceptionClass_Name(x)                                   \
     106    (PyClass_Check((x))                                            \
     107     ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name)          \
     108    : (char *)(((PyTypeObject*)(x))->tp_name))
     109
     110#define PyExceptionInstance_Class(x)                                    \
     111    ((PyInstance_Check((x))                                             \
     112      ? (PyObject*)((PyInstanceObject*)(x))->in_class                   \
     113      : (PyObject*)((x)->ob_type)))
     114
     115
    116116/* Predefined exceptions */
    117117
     
    185185PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
    186186PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
    187         PyObject *, PyObject *);
    188 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *);
    189 #ifdef Py_WIN_WIDE_FILENAMES
     187    PyObject *, PyObject *);
     188PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
     189    PyObject *, const char *);
     190#ifdef MS_WINDOWS
    190191PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
    191         PyObject *, Py_UNICODE *);
    192 #endif /* Py_WIN_WIDE_FILENAMES */
     192    PyObject *, const Py_UNICODE *);
     193#endif /* MS_WINDOWS */
    193194
    194195PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...)
    195                         Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
     196                        Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
    196197
    197198#ifdef MS_WINDOWS
    198199PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject(
    199         int, const char *);
     200    int, const char *);
    200201PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
    201         int, const char *);
    202 #ifdef Py_WIN_WIDE_FILENAMES
     202    int, const char *);
    203203PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
    204         int, const Py_UNICODE *);
    205 #endif /* Py_WIN_WIDE_FILENAMES */
     204    int, const Py_UNICODE *);
    206205PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
    207206PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
    208         PyObject *,int, PyObject *);
     207    PyObject *,int, PyObject *);
    209208PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
    210         PyObject *,int, const char *);
    211 #ifdef Py_WIN_WIDE_FILENAMES
     209    PyObject *,int, const char *);
    212210PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
    213         PyObject *,int, const Py_UNICODE *);
    214 #endif /* Py_WIN_WIDE_FILENAMES */
     211    PyObject *,int, const Py_UNICODE *);
    215212PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
    216213#endif /* MS_WINDOWS */
     
    224221
    225222/* Function to create a new exception */
    226 PyAPI_FUNC(PyObject *) PyErr_NewException(char *name, PyObject *base,
    227                                          PyObject *dict);
     223PyAPI_FUNC(PyObject *) PyErr_NewException(
     224    char *name, PyObject *base, PyObject *dict);
     225PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
     226    char *name, char *doc, PyObject *base, PyObject *dict);
    228227PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
    229228
     
    245244/* create a UnicodeDecodeError object */
    246245PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
    247         const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
     246    const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
    248247
    249248/* create a UnicodeEncodeError object */
    250249PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
    251         const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
     250    const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
    252251
    253252/* create a UnicodeTranslateError object */
    254253PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
    255         const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
     254    const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
    256255
    257256/* get the encoding attribute */
     
    296295   return 0 on success, -1 on failure */
    297296PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
    298         PyObject *, const char *);
     297    PyObject *, const char *);
    299298PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
    300         PyObject *, const char *);
     299    PyObject *, const char *);
    301300PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
    302         PyObject *, const char *);
     301    PyObject *, const char *);
    303302#endif
    304303
     
    320319#include <stdarg.h>
    321320PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char  *format, ...)
    322                         Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
     321                        Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
    323322PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char  *format, va_list va)
    324                         Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
     323                        Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
    325324
    326325#ifdef __cplusplus
  • python/vendor/current/Include/pyexpat.h

    r2 r388  
    55
    66#define PyExpat_CAPI_MAGIC  "pyexpat.expat_CAPI 1.0"
     7#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
    78
    89struct PyExpat_CAPI
  • python/vendor/current/Include/pyfpe.h

    r2 r388  
    55#endif
    66/*
    7      --------------------------------------------------------------------- 
    8     /                       Copyright (c) 1996.                           \ 
     7     ---------------------------------------------------------------------
     8    /                       Copyright (c) 1996.                           \
    99   |          The Regents of the University of California.                 |
    1010   |                        All rights reserved.                           |
     
    3838   |   reflect those of the United States Government or  the  University   |
    3939   |   of  California,  and shall not be used for advertising or product   |
    40     \  endorsement purposes.                                              / 
    41      --------------------------------------------------------------------- 
     40    \  endorsement purposes.                                              /
     41     ---------------------------------------------------------------------
    4242*/
    4343
  • python/vendor/current/Include/pygetopt.h

    r2 r388  
    1010PyAPI_DATA(char *) _PyOS_optarg;
    1111
     12PyAPI_FUNC(void) _PyOS_ResetGetOpt(void);
    1213PyAPI_FUNC(int) _PyOS_GetOpt(int argc, char **argv, char *optstring);
    1314
  • python/vendor/current/Include/pymacconfig.h

    r2 r388  
    55      * when building on MacOSX. This is needed for building 4-way
    66      * universal binaries and for 64-bit universal binaries because
    7       * the values redefined below aren't configure-time constant but 
     7      * the values redefined below aren't configure-time constant but
    88      * only compile-time constant in these scenarios.
    99      */
     
    1717# undef SIZEOF_VOID_P
    1818# undef SIZEOF__BOOL
     19# undef SIZEOF_UINTPTR_T
     20# undef SIZEOF_PTHREAD_T
    1921# undef WORDS_BIGENDIAN
     22# undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754
     23# undef DOUBLE_IS_BIG_ENDIAN_IEEE754
     24# undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754
     25# undef HAVE_GCC_ASM_FOR_X87
    2026
    2127#    undef VA_LIST_IS_ARRAY
     
    3137#    undef SIZEOF_LONG
    3238#    ifdef __LP64__
    33 #        define SIZEOF__BOOL            1
    34 #        define SIZEOF__BOOL            1
    35 #        define SIZEOF_LONG             8
    36 #        define SIZEOF_PTHREAD_T        8
    37 #        define SIZEOF_SIZE_T           8
    38 #        define SIZEOF_TIME_T           8
    39 #        define SIZEOF_VOID_P           8
     39#        define SIZEOF__BOOL            1
     40#        define SIZEOF__BOOL            1
     41#        define SIZEOF_LONG             8
     42#        define SIZEOF_PTHREAD_T        8
     43#        define SIZEOF_SIZE_T           8
     44#        define SIZEOF_TIME_T           8
     45#        define SIZEOF_VOID_P           8
     46#        define SIZEOF_UINTPTR_T        8
     47#        define SIZEOF_PTHREAD_T        8
    4048#    else
    4149#        ifdef __ppc__
    42 #           define SIZEOF__BOOL         4
     50#           define SIZEOF__BOOL         4
    4351#        else
    44 #           define SIZEOF__BOOL         1
     52#           define SIZEOF__BOOL         1
    4553#        endif
    46 #        define SIZEOF_LONG             4
    47 #        define SIZEOF_PTHREAD_T        4
    48 #        define SIZEOF_SIZE_T           4
    49 #        define SIZEOF_TIME_T           4
    50 #        define SIZEOF_VOID_P           4
     54#        define SIZEOF_LONG             4
     55#        define SIZEOF_PTHREAD_T        4
     56#        define SIZEOF_SIZE_T           4
     57#        define SIZEOF_TIME_T           4
     58#        define SIZEOF_VOID_P           4
     59#        define SIZEOF_UINTPTR_T        4
     60#        define SIZEOF_PTHREAD_T        4
    5161#    endif
    5262
    5363#    if defined(__LP64__)
    54          /* MacOSX 10.4 (the first release to suppport 64-bit code
    55           * at all) only supports 64-bit in the UNIX layer.
    56           * Therefore surpress the toolbox-glue in 64-bit mode.
    57           */
     64     /* MacOSX 10.4 (the first release to support 64-bit code
     65      * at all) only supports 64-bit in the UNIX layer.
     66      * Therefore surpress the toolbox-glue in 64-bit mode.
     67      */
    5868
    59         /* In 64-bit mode setpgrp always has no argments, in 32-bit
    60         * mode that depends on the compilation environment
    61         */
    62 #       undef SETPGRP_HAVE_ARG
     69    /* In 64-bit mode setpgrp always has no argments, in 32-bit
     70    * mode that depends on the compilation environment
     71    */
     72#       undef SETPGRP_HAVE_ARG
    6373
    6474#    endif
     
    6676#ifdef __BIG_ENDIAN__
    6777#define WORDS_BIGENDIAN 1
     78#define DOUBLE_IS_BIG_ENDIAN_IEEE754
     79#else
     80#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754
    6881#endif /* __BIG_ENDIAN */
    6982
    70         /*
    71          * The definition in pyconfig.h is only valid on the OS release
    72          * where configure ran on and not necessarily for all systems where
    73          * the executable can be used on.
    74          *
    75          * Specifically: OSX 10.4 has limited supported for '%zd', while
    76          * 10.5 has full support for '%zd'. A binary built on 10.5 won't
    77          * work properly on 10.4 unless we surpress the definition
    78          * of PY_FORMAT_SIZE_T
    79          */
    80 #undef  PY_FORMAT_SIZE_T
     83#ifdef __i386__
     84# define HAVE_GCC_ASM_FOR_X87
     85#endif
     86
     87    /*
     88     * The definition in pyconfig.h is only valid on the OS release
     89     * where configure ran on and not necessarily for all systems where
     90     * the executable can be used on.
     91     *
     92     * Specifically: OSX 10.4 has limited supported for '%zd', while
     93     * 10.5 has full support for '%zd'. A binary built on 10.5 won't
     94     * work properly on 10.4 unless we surpress the definition
     95     * of PY_FORMAT_SIZE_T
     96     */
     97#undef  PY_FORMAT_SIZE_T
    8198
    8299
  • python/vendor/current/Include/pymath.h

    r2 r388  
    33
    44#include "pyconfig.h" /* include for defines */
    5 
    6 #ifdef HAVE_STDINT_H
    7 #include <stdint.h>
    8 #endif
    95
    106/**************************************************************************
     
    139**************************************************************************/
    1410
    15 /* Python provides implementations for copysign, acosh, asinh, atanh,
    16  * log1p and hypot in Python/pymath.c just in case your math library doesn't
    17  * provide the functions.
     11/* Python provides implementations for copysign, round and hypot in
     12 * Python/pymath.c just in case your math library doesn't provide the
     13 * functions.
    1814 *
    1915 *Note: PC/pyconfig.h defines copysign as _copysign
     
    2319#endif
    2420
    25 #ifndef HAVE_ACOSH
    26 extern double acosh(double);
    27 #endif
    28 
    29 #ifndef HAVE_ASINH
    30 extern double asinh(double);
    31 #endif
    32 
    33 #ifndef HAVE_ATANH
    34 extern double atanh(double);
    35 #endif
    36 
    37 #ifndef HAVE_LOG1P
    38 extern double log1p(double);
     21#ifndef HAVE_ROUND
     22extern double round(double);
    3923#endif
    4024
     
    9175#    define Py_FORCE_DOUBLE(X) (X)
    9276#  endif
     77#endif
     78
     79#ifdef HAVE_GCC_ASM_FOR_X87
     80PyAPI_FUNC(unsigned short) _Py_get_387controlword(void);
     81PyAPI_FUNC(void) _Py_set_387controlword(unsigned short);
    9382#endif
    9483
  • python/vendor/current/Include/pymem.h

    r2 r388  
    6060#ifdef PYMALLOC_DEBUG
    6161/* Redirect all memory operations to Python's debugging allocator. */
    62 #define PyMem_MALLOC            PyObject_MALLOC
    63 #define PyMem_REALLOC           PyObject_REALLOC
    64 #define PyMem_FREE              PyObject_FREE
     62#define PyMem_MALLOC            _PyMem_DebugMalloc
     63#define PyMem_REALLOC           _PyMem_DebugRealloc
     64#define PyMem_FREE              _PyMem_DebugFree
    6565
    6666#else   /* ! PYMALLOC_DEBUG */
     
    7272/* Returns NULL to indicate error if a negative size or size larger than
    7373   Py_ssize_t can represent is supplied.  Helps prevents security holes. */
    74 #define PyMem_MALLOC(n)         (((n) < 0 || (n) > PY_SSIZE_T_MAX) ? NULL \
     74#define PyMem_MALLOC(n)         ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
    7575                                : malloc((n) ? (n) : 1))
    76 #define PyMem_REALLOC(p, n)     (((n) < 0 || (n) > PY_SSIZE_T_MAX) ? NULL \
     76#define PyMem_REALLOC(p, n)     ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
    7777                                : realloc((p), (n) ? (n) : 1))
    7878#define PyMem_FREE              free
  • python/vendor/current/Include/pyport.h

    r2 r388  
    33
    44#include "pyconfig.h" /* include for defines */
     5
     6/* Some versions of HP-UX & Solaris need inttypes.h for int32_t,
     7   INT32_MAX, etc. */
     8#ifdef HAVE_INTTYPES_H
     9#include <inttypes.h>
     10#endif
    511
    612#ifdef HAVE_STDINT_H
     
    8187#endif /* HAVE_LONG_LONG */
    8288
     89/* a build with 30-bit digits for Python long integers needs an exact-width
     90 * 32-bit unsigned integer type to store those digits.  (We could just use
     91 * type 'unsigned long', but that would be wasteful on a system where longs
     92 * are 64-bits.)  On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines
     93 * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t.
     94 * However, it doesn't set HAVE_UINT32_T, so we do that here.
     95 */
     96#ifdef uint32_t
     97#define HAVE_UINT32_T 1
     98#endif
     99
     100#ifdef HAVE_UINT32_T
     101#ifndef PY_UINT32_T
     102#define PY_UINT32_T uint32_t
     103#endif
     104#endif
     105
     106/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the
     107 * long integer implementation, when 30-bit digits are enabled.
     108 */
     109#ifdef uint64_t
     110#define HAVE_UINT64_T 1
     111#endif
     112
     113#ifdef HAVE_UINT64_T
     114#ifndef PY_UINT64_T
     115#define PY_UINT64_T uint64_t
     116#endif
     117#endif
     118
     119/* Signed variants of the above */
     120#ifdef int32_t
     121#define HAVE_INT32_T 1
     122#endif
     123
     124#ifdef HAVE_INT32_T
     125#ifndef PY_INT32_T
     126#define PY_INT32_T int32_t
     127#endif
     128#endif
     129
     130#ifdef int64_t
     131#define HAVE_INT64_T 1
     132#endif
     133
     134#ifdef HAVE_INT64_T
     135#ifndef PY_INT64_T
     136#define PY_INT64_T int64_t
     137#endif
     138#endif
     139
     140/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all
     141   the necessary integer types are available, and we're on a 64-bit platform
     142   (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */
     143
     144#ifndef PYLONG_BITS_IN_DIGIT
     145#if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \
     146     defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8)
     147#define PYLONG_BITS_IN_DIGIT 30
     148#else
     149#define PYLONG_BITS_IN_DIGIT 15
     150#endif
     151#endif
     152
    83153/* uintptr_t is the C9X name for an unsigned integral type such that a
    84154 * legitimate void* can be cast to uintptr_t and then back to void* again
     
    87157 */
    88158#ifdef HAVE_UINTPTR_T
    89 typedef uintptr_t       Py_uintptr_t;
    90 typedef intptr_t        Py_intptr_t;
     159typedef uintptr_t       Py_uintptr_t;
     160typedef intptr_t        Py_intptr_t;
    91161
    92162#elif SIZEOF_VOID_P <= SIZEOF_INT
    93 typedef unsigned int    Py_uintptr_t;
    94 typedef int             Py_intptr_t;
     163typedef unsigned int    Py_uintptr_t;
     164typedef int             Py_intptr_t;
    95165
    96166#elif SIZEOF_VOID_P <= SIZEOF_LONG
    97 typedef unsigned long   Py_uintptr_t;
    98 typedef long            Py_intptr_t;
     167typedef unsigned long   Py_uintptr_t;
     168typedef long            Py_intptr_t;
    99169
    100170#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
    101 typedef unsigned PY_LONG_LONG   Py_uintptr_t;
    102 typedef PY_LONG_LONG            Py_intptr_t;
     171typedef unsigned PY_LONG_LONG   Py_uintptr_t;
     172typedef PY_LONG_LONG            Py_intptr_t;
    103173
    104174#else
     
    111181 */
    112182#ifdef HAVE_SSIZE_T
    113 typedef ssize_t         Py_ssize_t;
     183typedef ssize_t         Py_ssize_t;
    114184#elif SIZEOF_VOID_P == SIZEOF_SIZE_T
    115 typedef Py_intptr_t     Py_ssize_t;
     185typedef Py_intptr_t     Py_ssize_t;
    116186#else
    117187#   error "Python needs a typedef for Py_ssize_t in pyport.h."
     
    121191   SIZE_MAX is part of C99, so it might be defined on some
    122192   platforms. If it is not defined, (size_t)-1 is a portable
    123    definition for C89, due to the way signed->unsigned 
     193   definition for C89, due to the way signed->unsigned
    124194   conversion is defined. */
    125195#ifdef SIZE_MAX
     
    173243#endif
    174244
     245/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for
     246 * the long long type instead of the size_t type.  It's only available
     247 * when HAVE_LONG_LONG is defined. The "high level" Python format
     248 * functions listed above will interpret "lld" or "llu" correctly on
     249 * all platforms.
     250 */
     251#ifdef HAVE_LONG_LONG
     252#   ifndef PY_FORMAT_LONG_LONG
     253#       if defined(MS_WIN64) || defined(MS_WINDOWS)
     254#           define PY_FORMAT_LONG_LONG "I64"
     255#       else
     256#           error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
     257#       endif
     258#   endif
     259#endif
     260
    175261/* Py_LOCAL can be used instead of static to get the fastest possible calling
    176262 * convention for functions that are local to a given module.
     
    197283#pragma optimize("agtw", on)
    198284#endif
    199 /* ignore warnings if the compiler decides not to inline a function */ 
     285/* ignore warnings if the compiler decides not to inline a function */
    200286#pragma warning(disable: 4710)
    201287/* fastest possible local call under MSVC */
     
    217303
    218304#if defined(_MSC_VER)
    219 #define Py_MEMCPY(target, source, length) do {                          \
    220                 size_t i_, n_ = (length);                               \
    221                 char *t_ = (void*) (target);                            \
    222                 const char *s_ = (void*) (source);                      \
    223                 if (n_ >= 16)                                           \
    224                         memcpy(t_, s_, n_);                             \
    225                 else                                                    \
    226                         for (i_ = 0; i_ < n_; i_++)                     \
    227                                 t_[i_] = s_[i_];                        \
    228         } while (0)
     305#define Py_MEMCPY(target, source, length) do {                          \
     306        size_t i_, n_ = (length);                                       \
     307        char *t_ = (void*) (target);                                    \
     308        const char *s_ = (void*) (source);                              \
     309        if (n_ >= 16)                                                   \
     310            memcpy(t_, s_, n_);                                         \
     311        else                                                            \
     312            for (i_ = 0; i_ < n_; i_++)                                 \
     313                t_[i_] = s_[i_];                                        \
     314    } while (0)
    229315#else
    230316#define Py_MEMCPY memcpy
     
    232318
    233319#include <stdlib.h>
     320
     321#ifdef HAVE_IEEEFP_H
     322#include <ieeefp.h>  /* needed for 'finite' declaration on some platforms */
     323#endif
    234324
    235325#include <math.h> /* Moved here from the math section, before extern "C" */
     
    328418 * or zero-fills.  Here a macro to force sign extension:
    329419 * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J)
    330  *    Return I >> J, forcing sign extension.
     420 *    Return I >> J, forcing sign extension.  Arithmetically, return the
     421 *    floor of I/2**J.
    331422 * Requirements:
    332  *    I is of basic signed type TYPE (char, short, int, long, or long long).
    333  *    TYPE is one of char, short, int, long, or long long, although long long
    334  *    must not be used except on platforms that support it.
    335  *    J is an integer >= 0 and strictly less than the number of bits in TYPE
    336  *    (because C doesn't define what happens for J outside that range either).
     423 *    I should have signed integer type.  In the terminology of C99, this can
     424 *    be either one of the five standard signed integer types (signed char,
     425 *    short, int, long, long long) or an extended signed integer type.
     426 *    J is an integer >= 0 and strictly less than the number of bits in the
     427 *    type of I (because C doesn't define what happens for J outside that
     428 *    range either).
     429 *    TYPE used to specify the type of I, but is now ignored.  It's been left
     430 *    in for backwards compatibility with versions <= 2.6 or 3.0.
    337431 * Caution:
    338432 *    I may be evaluated more than once.
     
    340434#ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS
    341435#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \
    342         ((I) < 0 ? ~((~(unsigned TYPE)(I)) >> (J)) : (I) >> (J))
     436    ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J))
    343437#else
    344438#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J))
     
    360454#ifdef Py_DEBUG
    361455#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \
    362         (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE))
     456    (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE))
    363457#else
    364458#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE)
     
    380474#endif
    381475#define Py_SET_ERRNO_ON_MATH_ERROR(X) \
    382         do { \
    383                 if (errno == 0) { \
    384                         if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \
    385                                 errno = ERANGE; \
    386                         else _Py_SET_EDOM_FOR_NAN(X) \
    387                 } \
    388         } while(0)
     476    do { \
     477        if (errno == 0) { \
     478            if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \
     479                errno = ERANGE; \
     480            else _Py_SET_EDOM_FOR_NAN(X) \
     481        } \
     482    } while(0)
    389483
    390484/* Py_SET_ERANGE_ON_OVERFLOW(x)
     
    407501 *    X and Y may be evaluated more than once.
    408502 */
    409 #define Py_ADJUST_ERANGE1(X)                                            \
    410         do {                                                            \
    411                 if (errno == 0) {                                       \
    412                         if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL)  \
    413                                 errno = ERANGE;                         \
    414                 }                                                       \
    415                 else if (errno == ERANGE && (X) == 0.0)                 \
    416                         errno = 0;                                      \
    417         } while(0)
    418 
    419 #define Py_ADJUST_ERANGE2(X, Y)                                         \
    420         do {                                                            \
    421                 if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL ||        \
    422                     (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) {        \
    423                                 if (errno == 0)                         \
    424                                         errno = ERANGE;                 \
    425                 }                                                       \
    426                 else if (errno == ERANGE)                               \
    427                         errno = 0;                                      \
    428         } while(0)
     503#define Py_ADJUST_ERANGE1(X)                                            \
     504    do {                                                                \
     505        if (errno == 0) {                                               \
     506            if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL)              \
     507                errno = ERANGE;                                         \
     508        }                                                               \
     509        else if (errno == ERANGE && (X) == 0.0)                         \
     510            errno = 0;                                                  \
     511    } while(0)
     512
     513#define Py_ADJUST_ERANGE2(X, Y)                                         \
     514    do {                                                                \
     515        if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL ||                \
     516            (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) {                \
     517                        if (errno == 0)                                 \
     518                                errno = ERANGE;                         \
     519        }                                                               \
     520        else if (errno == ERANGE)                                       \
     521            errno = 0;                                                  \
     522    } while(0)
     523
     524/*  The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are
     525 *  required to support the short float repr introduced in Python 3.1) require
     526 *  that the floating-point unit that's being used for arithmetic operations
     527 *  on C doubles is set to use 53-bit precision.  It also requires that the
     528 *  FPU rounding mode is round-half-to-even, but that's less often an issue.
     529 *
     530 *  If your FPU isn't already set to 53-bit precision/round-half-to-even, and
     531 *  you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should
     532 *
     533 *     #define HAVE_PY_SET_53BIT_PRECISION 1
     534 *
     535 *  and also give appropriate definitions for the following three macros:
     536 *
     537 *    _PY_SET_53BIT_PRECISION_START : store original FPU settings, and
     538 *        set FPU to 53-bit precision/round-half-to-even
     539 *    _PY_SET_53BIT_PRECISION_END : restore original FPU settings
     540 *    _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to
     541 *        use the two macros above.
     542 *
     543 * The macros are designed to be used within a single C function: see
     544 * Python/pystrtod.c for an example of their use.
     545 */
     546
     547/* get and set x87 control word for gcc/x86 */
     548#ifdef HAVE_GCC_ASM_FOR_X87
     549#define HAVE_PY_SET_53BIT_PRECISION 1
     550/* _Py_get/set_387controlword functions are defined in Python/pymath.c */
     551#define _Py_SET_53BIT_PRECISION_HEADER                          \
     552    unsigned short old_387controlword, new_387controlword
     553#define _Py_SET_53BIT_PRECISION_START                                   \
     554    do {                                                                \
     555        old_387controlword = _Py_get_387controlword();                  \
     556        new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \
     557        if (new_387controlword != old_387controlword)                   \
     558            _Py_set_387controlword(new_387controlword);                 \
     559    } while (0)
     560#define _Py_SET_53BIT_PRECISION_END                             \
     561    if (new_387controlword != old_387controlword)               \
     562        _Py_set_387controlword(old_387controlword)
     563#endif
     564
     565/* get and set x87 control word for VisualStudio/x86 */
     566#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */
     567#define HAVE_PY_SET_53BIT_PRECISION 1
     568#define _Py_SET_53BIT_PRECISION_HEADER \
     569    unsigned int old_387controlword, new_387controlword, out_387controlword
     570/* We use the __control87_2 function to set only the x87 control word.
     571   The SSE control word is unaffected. */
     572#define _Py_SET_53BIT_PRECISION_START                                   \
     573    do {                                                                \
     574        __control87_2(0, 0, &old_387controlword, NULL);                 \
     575        new_387controlword =                                            \
     576          (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \
     577        if (new_387controlword != old_387controlword)                   \
     578            __control87_2(new_387controlword, _MCW_PC | _MCW_RC,        \
     579                          &out_387controlword, NULL);                   \
     580    } while (0)
     581#define _Py_SET_53BIT_PRECISION_END                                     \
     582    do {                                                                \
     583        if (new_387controlword != old_387controlword)                   \
     584            __control87_2(old_387controlword, _MCW_PC | _MCW_RC,        \
     585                          &out_387controlword, NULL);                   \
     586    } while (0)
     587#endif
     588
     589/* default definitions are empty */
     590#ifndef HAVE_PY_SET_53BIT_PRECISION
     591#define _Py_SET_53BIT_PRECISION_HEADER
     592#define _Py_SET_53BIT_PRECISION_START
     593#define _Py_SET_53BIT_PRECISION_END
     594#endif
     595
     596/* If we can't guarantee 53-bit precision, don't use the code
     597   in Python/dtoa.c, but fall back to standard code.  This
     598   means that repr of a float will be long (17 sig digits).
     599
     600   Realistically, there are two things that could go wrong:
     601
     602   (1) doubles aren't IEEE 754 doubles, or
     603   (2) we're on x86 with the rounding precision set to 64-bits
     604       (extended precision), and we don't know how to change
     605       the rounding precision.
     606 */
     607
     608#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \
     609    !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \
     610    !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754)
     611#define PY_NO_SHORT_FLOAT_REPR
     612#endif
     613
     614/* double rounding is symptomatic of use of extended precision on x86.  If
     615   we're seeing double rounding, and we don't have any mechanism available for
     616   changing the FPU rounding precision, then don't use Python/dtoa.c. */
     617#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION)
     618#define PY_NO_SHORT_FLOAT_REPR
     619#endif
    429620
    430621/* Py_DEPRECATED(version)
     
    436627 */
    437628#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
    438                           (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
     629              (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
    439630#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
    440631#else
     
    462653
    463654#ifdef HAVE__GETPTY
    464 #include <sys/types.h>          /* we need to import mode_t */
     655#include <sys/types.h>          /* we need to import mode_t */
    465656extern char * _getpty(int *, int, mode_t, int);
    466657#endif
     
    469660   if TCGETA, TCSETA, TCSETAW, or TCSETAF are used.  sys/termio.h must
    470661   be included before termios.h or it will generate an error. */
    471 #ifdef HAVE_SYS_TERMIO_H
     662#if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux)
    472663#include <sys/termio.h>
    473664#endif
    474665
    475666#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY)
    476 #if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H)
     667#if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) && !defined(HAVE_UTIL_H)
    477668/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
    478669   functions, even though they are included in libutil. */
     
    513704#include <osreldate.h>
    514705#if __FreeBSD_version > 500039
     706# define _PY_PORT_CTYPE_UTF8_ISSUE
     707#endif
     708#endif
     709
     710
     711#if defined(__APPLE__)
     712# define _PY_PORT_CTYPE_UTF8_ISSUE
     713#endif
     714
     715#ifdef _PY_PORT_CTYPE_UTF8_ISSUE
    515716#include <ctype.h>
    516717#include <wctype.h>
     
    530731#define toupper(c) towupper(btowc(c))
    531732#endif
    532 #endif
    533733
    534734
     
    553753*/
    554754#if defined(__CYGWIN__) || defined(__BEOS__)
    555 #       define HAVE_DECLSPEC_DLL
     755#       define HAVE_DECLSPEC_DLL
    556756#endif
    557757
    558758/* only get special linkage if built as shared or platform is Cygwin */
    559759#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__)
    560 #       if defined(HAVE_DECLSPEC_DLL)
    561 #               ifdef Py_BUILD_CORE
    562 #                       define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
    563 #                       define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
    564                         /* module init functions inside the core need no external linkage */
    565                         /* except for Cygwin to handle embedding (FIXME: BeOS too?) */
    566 #                       if defined(__CYGWIN__)
    567 #                               define PyMODINIT_FUNC __declspec(dllexport) void
    568 #                       else /* __CYGWIN__ */
    569 #                               define PyMODINIT_FUNC void
    570 #                       endif /* __CYGWIN__ */
    571 #               else /* Py_BUILD_CORE */
    572                         /* Building an extension module, or an embedded situation */
    573                         /* public Python functions and data are imported */
    574                         /* Under Cygwin, auto-import functions to prevent compilation */
    575                         /* failures similar to http://python.org/doc/FAQ.html#3.24 */
    576 #                       if !defined(__CYGWIN__)
    577 #                               define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE
    578 #                       endif /* !__CYGWIN__ */
    579 #                       define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
    580                         /* module init functions outside the core must be exported */
    581 #                       if defined(__cplusplus)
    582 #                               define PyMODINIT_FUNC extern "C" __declspec(dllexport) void
    583 #                       else /* __cplusplus */
    584 #                               define PyMODINIT_FUNC __declspec(dllexport) void
    585 #                       endif /* __cplusplus */
    586 #               endif /* Py_BUILD_CORE */
    587 #       endif /* HAVE_DECLSPEC */
     760#       if defined(HAVE_DECLSPEC_DLL)
     761#               ifdef Py_BUILD_CORE
     762#                       define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
     763#                       define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
     764        /* module init functions inside the core need no external linkage */
     765        /* except for Cygwin to handle embedding (FIXME: BeOS too?) */
     766#                       if defined(__CYGWIN__)
     767#                               define PyMODINIT_FUNC __declspec(dllexport) void
     768#                       else /* __CYGWIN__ */
     769#                               define PyMODINIT_FUNC void
     770#                       endif /* __CYGWIN__ */
     771#               else /* Py_BUILD_CORE */
     772        /* Building an extension module, or an embedded situation */
     773        /* public Python functions and data are imported */
     774        /* Under Cygwin, auto-import functions to prevent compilation */
     775        /* failures similar to those described at the bottom of 4.1: */
     776        /* http://docs.python.org/extending/windows.html#a-cookbook-approach */
     777#                       if !defined(__CYGWIN__)
     778#                               define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE
     779#                       endif /* !__CYGWIN__ */
     780#                       define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
     781        /* module init functions outside the core must be exported */
     782#                       if defined(__cplusplus)
     783#                               define PyMODINIT_FUNC extern "C" __declspec(dllexport) void
     784#                       else /* __cplusplus */
     785#                               define PyMODINIT_FUNC __declspec(dllexport) void
     786#                       endif /* __cplusplus */
     787#               endif /* Py_BUILD_CORE */
     788#       endif /* HAVE_DECLSPEC */
    588789#endif /* Py_ENABLE_SHARED */
    589790
    590791/* If no external linkage macros defined by now, create defaults */
    591792#ifndef PyAPI_FUNC
    592 #       define PyAPI_FUNC(RTYPE) RTYPE
     793#       define PyAPI_FUNC(RTYPE) RTYPE
    593794#endif
    594795#ifndef PyAPI_DATA
    595 #       define PyAPI_DATA(RTYPE) extern RTYPE
     796#       define PyAPI_DATA(RTYPE) extern RTYPE
    596797#endif
    597798#ifndef PyMODINIT_FUNC
    598 #       if defined(__cplusplus)
    599 #               define PyMODINIT_FUNC extern "C" void
    600 #       else /* __cplusplus */
    601 #               define PyMODINIT_FUNC void
    602 #       endif /* __cplusplus */
     799#       if defined(__cplusplus)
     800#               define PyMODINIT_FUNC extern "C" void
     801#       else /* __cplusplus */
     802#               define PyMODINIT_FUNC void
     803#       endif /* __cplusplus */
    603804#endif
    604805
    605806/* Deprecated DL_IMPORT and DL_EXPORT macros */
    606807#if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL)
    607 #       if defined(Py_BUILD_CORE)
    608 #               define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
    609 #               define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
    610 #       else
    611 #               define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
    612 #               define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
    613 #       endif
     808#       if defined(Py_BUILD_CORE)
     809#               define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
     810#               define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
     811#       else
     812#               define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
     813#               define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
     814#       endif
    614815#endif
    615816#ifndef DL_EXPORT
    616 #       define DL_EXPORT(RTYPE) RTYPE
     817#       define DL_EXPORT(RTYPE) RTYPE
    617818#endif
    618819#ifndef DL_IMPORT
    619 #       define DL_IMPORT(RTYPE) RTYPE
     820#       define DL_IMPORT(RTYPE) RTYPE
    620821#endif
    621822/* End of deprecated DL_* macros */
     
    626827#if 0 /* disabled and probably obsolete */
    627828
    628 #ifndef FD_SETSIZE
    629 #define FD_SETSIZE      256
     829#ifndef FD_SETSIZE
     830#define FD_SETSIZE      256
    630831#endif
    631832
     
    634835typedef long fd_mask;
    635836
    636 #define NFDBITS (sizeof(fd_mask) * NBBY)        /* bits per mask */
     837#define NFDBITS (sizeof(fd_mask) * NBBY)        /* bits per mask */
    637838#ifndef howmany
    638 #define howmany(x, y)   (((x)+((y)-1))/(y))
     839#define howmany(x, y)   (((x)+((y)-1))/(y))
    639840#endif /* howmany */
    640841
    641 typedef struct fd_set {
    642         fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
     842typedef struct fd_set {
     843    fd_mask     fds_bits[howmany(FD_SETSIZE, NFDBITS)];
    643844} fd_set;
    644845
    645 #define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
    646 #define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
    647 #define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
    648 #define FD_ZERO(p)      memset((char *)(p), '\0', sizeof(*(p)))
     846#define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
     847#define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
     848#define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
     849#define FD_ZERO(p)      memset((char *)(p), '\0', sizeof(*(p)))
    649850
    650851#endif /* FD_SET */
  • python/vendor/current/Include/pystate.h

    r2 r388  
    9696    long thread_id; /* Thread id where this tstate was created */
    9797
     98    int trash_delete_nesting;
     99    PyObject *trash_delete_later;
     100
    98101    /* XXX signal handlers should also be here */
    99102
     
    106109
    107110PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
     111PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *);
     112PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *);
    108113PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *);
    109114PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
     
    167172/* Helper/diagnostic function - get the current thread state for
    168173   this thread.  May return NULL if no GILState API has been used
    169    on the current thread.  Note the main thread always has such a
     174   on the current thread.  Note that the main thread always has such a
    170175   thread-state, even if no auto-thread-state call has been made
    171176   on the main thread.
  • python/vendor/current/Include/pystrtod.h

    r2 r388  
    99PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr);
    1010PyAPI_FUNC(double) PyOS_ascii_atof(const char *str);
    11 PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len,  const char *format, double d);
    1211
     12/* Deprecated in 2.7 and 3.1. Will disappear in 2.8 (if it exists) and 3.2 */
     13PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len,
     14                                      const char *format, double d);
     15PyAPI_FUNC(double) PyOS_string_to_double(const char *str,
     16                                         char **endptr,
     17                                         PyObject *overflow_exception);
     18
     19/* The caller is responsible for calling PyMem_Free to free the buffer
     20   that's is returned. */
     21PyAPI_FUNC(char *) PyOS_double_to_string(double val,
     22                                         char format_code,
     23                                         int precision,
     24                                         int flags,
     25                                         int *type);
     26
     27PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr);
     28
     29
     30/* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */
     31#define Py_DTSF_SIGN      0x01 /* always add the sign */
     32#define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */
     33#define Py_DTSF_ALT       0x04 /* "alternate" formatting. it's format_code
     34                                  specific */
     35
     36/* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */
     37#define Py_DTST_FINITE 0
     38#define Py_DTST_INFINITE 1
     39#define Py_DTST_NAN 2
    1340
    1441#ifdef __cplusplus
  • python/vendor/current/Include/pythonrun.h

    r2 r388  
    1717
    1818typedef struct {
    19         int cf_flags;  /* bitmask of CO_xxx flags relevant to future */
     19    int cf_flags;  /* bitmask of CO_xxx flags relevant to future */
    2020} PyCompilerFlags;
    2121
     
    4040PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
    4141
    42 PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *, 
    43                                                 int, PyCompilerFlags *flags,
     42PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *,
     43                                                int, PyCompilerFlags *flags,
    4444                                                 PyArena *);
    45 PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, 
    46                                                char *, char *,
     45PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int,
     46                                               char *, char *,
    4747                                               PyCompilerFlags *, int *,
    4848                                               PyArena *);
    4949#define PyParser_SimpleParseString(S, B) \
    50         PyParser_SimpleParseStringFlags(S, B, 0)
     50    PyParser_SimpleParseStringFlags(S, B, 0)
    5151#define PyParser_SimpleParseFile(FP, S, B) \
    52         PyParser_SimpleParseFileFlags(FP, S, B, 0)
    53 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, 
    54                                                           int);
     52    PyParser_SimpleParseFileFlags(FP, S, B, 0)
     53PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
     54                                                          int);
    5555PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
    56                                                         int, int);
     56                                                        int, int);
    5757
    58 PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, 
    59                                         PyObject *, PyCompilerFlags *);
     58PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
     59                                        PyObject *, PyCompilerFlags *);
    6060
    61 PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, 
    62                                          PyObject *, PyObject *, int,
    63                                         PyCompilerFlags *);
     61PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int,
     62                                         PyObject *, PyObject *, int,
     63                                        PyCompilerFlags *);
    6464
    6565#define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL)
    6666PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
    67                                              PyCompilerFlags *);
     67                                             PyCompilerFlags *);
    6868PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
    6969
     
    8585#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
    8686#define PyRun_AnyFileEx(fp, name, closeit) \
    87         PyRun_AnyFileExFlags(fp, name, closeit, NULL)
     87    PyRun_AnyFileExFlags(fp, name, closeit, NULL)
    8888#define PyRun_AnyFileFlags(fp, name, flags) \
    89         PyRun_AnyFileExFlags(fp, name, 0, flags)
     89    PyRun_AnyFileExFlags(fp, name, 0, flags)
    9090#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
    9191#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
     
    9494#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
    9595#define PyRun_File(fp, p, s, g, l) \
    96         PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
     96    PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
    9797#define PyRun_FileEx(fp, p, s, g, l, c) \
    98         PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
     98    PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
    9999#define PyRun_FileFlags(fp, p, s, g, l, flags) \
    100         PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
     100    PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
    101101
    102102/* In getpath.c */
     
    115115PyAPI_FUNC(const char *) Py_SubversionRevision(void);
    116116PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
     117PyAPI_FUNC(const char *) _Py_hgidentifier(void);
     118PyAPI_FUNC(const char *) _Py_hgversion(void);
    117119
    118120/* Internal -- various one-time initializations */
     
    124126PyAPI_FUNC(int) _PyFrame_Init(void);
    125127PyAPI_FUNC(int) _PyInt_Init(void);
     128PyAPI_FUNC(int) _PyLong_Init(void);
    126129PyAPI_FUNC(void) _PyFloat_Init(void);
    127130PyAPI_FUNC(int) PyByteArray_Init(void);
     131PyAPI_FUNC(void) _PyRandom_Init(void);
    128132
    129133/* Various internal finalizers */
     
    169173PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
    170174
     175/* Random */
     176PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size);
    171177
    172178#ifdef __cplusplus
  • python/vendor/current/Include/pythread.h

    r2 r388  
    22#ifndef Py_PYTHREAD_H
    33#define Py_PYTHREAD_H
    4 
    5 #define NO_EXIT_PROG            /* don't define PyThread_exit_prog() */
    6                                 /* (the result is no use of signals on SGI) */
    74
    85typedef void *PyThread_type_lock;
     
    1613PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *);
    1714PyAPI_FUNC(void) PyThread_exit_thread(void);
    18 PyAPI_FUNC(void) PyThread__PyThread_exit_thread(void);
    1915PyAPI_FUNC(long) PyThread_get_thread_ident(void);
    2016
     
    2824PyAPI_FUNC(size_t) PyThread_get_stacksize(void);
    2925PyAPI_FUNC(int) PyThread_set_stacksize(size_t);
    30 
    31 #ifndef NO_EXIT_PROG
    32 PyAPI_FUNC(void) PyThread_exit_prog(int);
    33 PyAPI_FUNC(void) PyThread__PyThread_exit_prog(int);
    34 #endif
    3526
    3627/* Thread Local Storage (TLS) API */
  • python/vendor/current/Include/setobject.h

    r2 r388  
    2323
    2424typedef struct {
    25         long hash;      /* cached hash code for the entry key */
    26         PyObject *key;
     25    long hash;      /* cached hash code for the entry key */
     26    PyObject *key;
    2727} setentry;
    2828
     
    3434typedef struct _setobject PySetObject;
    3535struct _setobject {
    36         PyObject_HEAD
     36    PyObject_HEAD
    3737
    38         Py_ssize_t fill;  /* # Active + # Dummy */
    39         Py_ssize_t used;  /* # Active */
     38    Py_ssize_t fill;  /* # Active + # Dummy */
     39    Py_ssize_t used;  /* # Active */
    4040
    41         /* The table contains mask + 1 slots, and that's a power of 2.
    42         * We store the mask instead of the size because the mask is more
    43         * frequently needed.
    44         */
    45         Py_ssize_t mask;
     41    /* The table contains mask + 1 slots, and that's a power of 2.
     42    * We store the mask instead of the size because the mask is more
     43    * frequently needed.
     44    */
     45    Py_ssize_t mask;
    4646
    47         /* table points to smalltable for small tables, else to
    48         * additional malloc'ed memory.  table is never NULL!  This rule
    49         * saves repeated runtime null-tests.
    50         */
    51         setentry *table;
    52         setentry *(*lookup)(PySetObject *so, PyObject *key, long hash);
    53         setentry smalltable[PySet_MINSIZE];
     47    /* table points to smalltable for small tables, else to
     48    * additional malloc'ed memory.  table is never NULL!  This rule
     49    * saves repeated runtime null-tests.
     50    */
     51    setentry *table;
     52    setentry *(*lookup)(PySetObject *so, PyObject *key, long hash);
     53    setentry smalltable[PySet_MINSIZE];
    5454
    55         long hash;              /* only used by frozenset objects */
    56         PyObject *weakreflist;  /* List of weak references */
     55    long hash;                  /* only used by frozenset objects */
     56    PyObject *weakreflist;      /* List of weak references */
    5757};
    5858
     
    6969#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type)
    7070#define PyAnySet_CheckExact(ob) \
    71         (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type)
     71    (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type)
    7272#define PyAnySet_Check(ob) \
    73         (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
    74           PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
    75           PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
     73    (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
     74      PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
     75      PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
    7676#define PySet_Check(ob) \
    77         (Py_TYPE(ob) == &PySet_Type || \
    78         PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
     77    (Py_TYPE(ob) == &PySet_Type || \
     78    PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
    7979#define   PyFrozenSet_Check(ob) \
    80         (Py_TYPE(ob) == &PyFrozenSet_Type || \
    81           PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
     80    (Py_TYPE(ob) == &PyFrozenSet_Type || \
     81      PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
    8282
    8383PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
  • python/vendor/current/Include/stringobject.h

    r2 r388  
    178178    );
    179179
     180
    180181/* Using the current locale, insert the thousands grouping
    181182   into the string pointed to by buffer.  For the argument descriptions,
    182183   see Objects/stringlib/localeutil.h */
    183 
    184 PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer,
    185                                                   Py_ssize_t n_buffer,
    186                                                   Py_ssize_t n_digits,
    187                                                   Py_ssize_t buf_size,
    188                                                   Py_ssize_t *count,
    189                                                   int append_zero_char);
     184PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGroupingLocale(char *buffer,
     185                                  Py_ssize_t n_buffer,
     186                                  char *digits,
     187                                  Py_ssize_t n_digits,
     188                                  Py_ssize_t min_width);
     189
     190/* Using explicit passed-in values, insert the thousands grouping
     191   into the string pointed to by buffer.  For the argument descriptions,
     192   see Objects/stringlib/localeutil.h */
     193PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGrouping(char *buffer,
     194                                  Py_ssize_t n_buffer,
     195                                  char *digits,
     196                                  Py_ssize_t n_digits,
     197                                  Py_ssize_t min_width,
     198                                  const char *grouping,
     199                                  const char *thousands_sep);
    190200
    191201/* Format the object based on the format_spec, as defined in PEP 3101
  • python/vendor/current/Include/structmember.h

    r2 r388  
    2727
    2828struct memberlist {
    29         /* Obsolete version, for binary backwards compatibility */
    30         char *name;
    31         int type;
    32         int offset;
    33         int flags;
     29    /* Obsolete version, for binary backwards compatibility */
     30    char *name;
     31    int type;
     32    int offset;
     33    int flags;
    3434};
    3535
    3636typedef struct PyMemberDef {
    37         /* Current version, use this */
    38         char *name;
    39         int type;
    40         Py_ssize_t offset;
    41         int flags;
    42         char *doc;
     37    /* Current version, use this */
     38    char *name;
     39    int type;
     40    Py_ssize_t offset;
     41    int flags;
     42    char *doc;
    4343} PyMemberDef;
    4444
    4545/* Types */
    46 #define T_SHORT         0
    47 #define T_INT           1
    48 #define T_LONG          2
    49 #define T_FLOAT         3
    50 #define T_DOUBLE        4
    51 #define T_STRING        5
    52 #define T_OBJECT        6
     46#define T_SHORT         0
     47#define T_INT           1
     48#define T_LONG          2
     49#define T_FLOAT         3
     50#define T_DOUBLE        4
     51#define T_STRING        5
     52#define T_OBJECT        6
    5353/* XXX the ordering here is weird for binary compatibility */
    54 #define T_CHAR          7       /* 1-character string */
    55 #define T_BYTE          8       /* 8-bit signed int */
     54#define T_CHAR          7       /* 1-character string */
     55#define T_BYTE          8       /* 8-bit signed int */
    5656/* unsigned variants: */
    57 #define T_UBYTE         9
    58 #define T_USHORT        10
    59 #define T_UINT          11
    60 #define T_ULONG         12
     57#define T_UBYTE         9
     58#define T_USHORT        10
     59#define T_UINT          11
     60#define T_ULONG         12
    6161
    6262/* Added by Jack: strings contained in the structure */
    63 #define T_STRING_INPLACE        13
     63#define T_STRING_INPLACE        13
    6464
    6565/* Added by Lillo: bools contained in the structure (assumed char) */
    66 #define T_BOOL          14
     66#define T_BOOL          14
    6767
    68 #define T_OBJECT_EX     16      /* Like T_OBJECT, but raises AttributeError
    69                                    when the value is NULL, instead of
    70                                    converting to None. */
     68#define T_OBJECT_EX     16      /* Like T_OBJECT, but raises AttributeError
     69                   when the value is NULL, instead of
     70                   converting to None. */
    7171#ifdef HAVE_LONG_LONG
    72 #define T_LONGLONG      17 
     72#define T_LONGLONG      17
    7373#define T_ULONGLONG      18
    7474#endif /* HAVE_LONG_LONG */
     
    7878
    7979/* Flags */
    80 #define READONLY        1
    81 #define RO              READONLY                /* Shorthand */
    82 #define READ_RESTRICTED 2
     80#define READONLY        1
     81#define RO              READONLY                /* Shorthand */
     82#define READ_RESTRICTED 2
    8383#define PY_WRITE_RESTRICTED 4
    84 #define RESTRICTED      (READ_RESTRICTED | PY_WRITE_RESTRICTED)
     84#define RESTRICTED      (READ_RESTRICTED | PY_WRITE_RESTRICTED)
    8585
    8686
  • python/vendor/current/Include/symtable.h

    r2 r388  
    1212
    1313struct symtable {
    14         const char *st_filename; /* name of file being compiled */
    15         struct _symtable_entry *st_cur; /* current symbol table entry */
    16         struct _symtable_entry *st_top; /* module entry */
    17         PyObject *st_symbols;    /* dictionary of symbol table entries */
    18         PyObject *st_stack;      /* stack of namespace info */
    19         PyObject *st_global;     /* borrowed ref to MODULE in st_symbols */
    20         int st_nblocks;          /* number of blocks */
    21         PyObject *st_private;        /* name of current class or NULL */
    22         int st_tmpname;          /* temporary name counter */
    23         PyFutureFeatures *st_future; /* module's future features */
     14    const char *st_filename; /* name of file being compiled */
     15    struct _symtable_entry *st_cur; /* current symbol table entry */
     16    struct _symtable_entry *st_top; /* module entry */
     17    PyObject *st_symbols;    /* dictionary of symbol table entries */
     18    PyObject *st_stack;      /* stack of namespace info */
     19    PyObject *st_global;     /* borrowed ref to MODULE in st_symbols */
     20    int st_nblocks;          /* number of blocks */
     21    PyObject *st_private;        /* name of current class or NULL */
     22    PyFutureFeatures *st_future; /* module's future features */
    2423};
    2524
    2625typedef struct _symtable_entry {
    27         PyObject_HEAD
    28         PyObject *ste_id;        /* int: key in st_symbols */
    29         PyObject *ste_symbols;   /* dict: name to flags */
    30         PyObject *ste_name;      /* string: name of block */
    31         PyObject *ste_varnames;  /* list of variable names */
    32         PyObject *ste_children;  /* list of child ids */
    33         _Py_block_ty ste_type;   /* module, class, or function */
    34         int ste_unoptimized;     /* false if namespace is optimized */
    35         int ste_nested;      /* true if block is nested */
    36         unsigned ste_free : 1;        /* true if block has free variables */
    37         unsigned ste_child_free : 1;  /* true if a child block has free vars,
    38                                          including free refs to globals */
    39         unsigned ste_generator : 1;   /* true if namespace is a generator */
    40         unsigned ste_varargs : 1;     /* true if block has varargs */
    41         unsigned ste_varkeywords : 1; /* true if block has varkeywords */
    42         unsigned ste_returns_value : 1;  /* true if namespace uses return with
    43                                             an argument */
    44         int ste_lineno;          /* first line of block */
    45         int ste_opt_lineno;      /* lineno of last exec or import * */
    46         int ste_tmpname;         /* counter for listcomp temp vars */
    47         struct symtable *ste_table;
     26    PyObject_HEAD
     27    PyObject *ste_id;        /* int: key in st_symbols */
     28    PyObject *ste_symbols;   /* dict: name to flags */
     29    PyObject *ste_name;      /* string: name of block */
     30    PyObject *ste_varnames;  /* list of variable names */
     31    PyObject *ste_children;  /* list of child ids */
     32    _Py_block_ty ste_type;   /* module, class, or function */
     33    int ste_unoptimized;     /* false if namespace is optimized */
     34    int ste_nested;      /* true if block is nested */
     35    unsigned ste_free : 1;        /* true if block has free variables */
     36    unsigned ste_child_free : 1;  /* true if a child block has free vars,
     37                                     including free refs to globals */
     38    unsigned ste_generator : 1;   /* true if namespace is a generator */
     39    unsigned ste_varargs : 1;     /* true if block has varargs */
     40    unsigned ste_varkeywords : 1; /* true if block has varkeywords */
     41    unsigned ste_returns_value : 1;  /* true if namespace uses return with
     42                                        an argument */
     43    int ste_lineno;          /* first line of block */
     44    int ste_opt_lineno;      /* lineno of last exec or import * */
     45    int ste_tmpname;         /* counter for listcomp temp vars */
     46    struct symtable *ste_table;
    4847} PySTEntryObject;
    4948
     
    5453PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);
    5554
    56 PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *, 
    57                                               PyFutureFeatures *);
     55PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *,
     56                                              PyFutureFeatures *);
    5857PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *);
    5958
     
    6665#define DEF_PARAM 2<<1         /* formal parameter */
    6766#define USE 2<<2               /* name is used */
    68 #define DEF_STAR 2<<3          /* parameter is star arg */
    69 #define DEF_DOUBLESTAR 2<<4    /* parameter is star-star arg */
    70 #define DEF_INTUPLE 2<<5       /* name defined in tuple in parameters */
    71 #define DEF_FREE 2<<6          /* name used but not defined in nested block */
    72 #define DEF_FREE_GLOBAL 2<<7   /* free variable is actually implicit global */
    73 #define DEF_FREE_CLASS 2<<8    /* free variable from class's method */
    74 #define DEF_IMPORT 2<<9        /* assignment occurred via import */
     67#define DEF_FREE 2<<3         /* name used but not defined in nested block */
     68#define DEF_FREE_CLASS 2<<4    /* free variable from class's method */
     69#define DEF_IMPORT 2<<5        /* assignment occurred via import */
    7570
    7671#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT)
    7772
    7873/* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol
    79    table.  GLOBAL is returned from PyST_GetScope() for either of them. 
     74   table.  GLOBAL is returned from PyST_GetScope() for either of them.
    8075   It is stored in ste_symbols at bits 12-14.
    8176*/
  • python/vendor/current/Include/sysmodule.h

    r2 r388  
    1212PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *);
    1313PyAPI_FUNC(void) PySys_SetArgv(int, char **);
     14PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int);
    1415PyAPI_FUNC(void) PySys_SetPath(char *);
    1516
     
    1819PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
    1920                        Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
    20 
    21 PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc;
    22 PyAPI_DATA(int) _PySys_CheckInterval;
    2321
    2422PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
  • python/vendor/current/Include/timefuncs.h

    r2 r388  
    1717PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x);
    1818
     19/* Get the current time since the epoch in seconds */
     20PyAPI_FUNC(double) _PyTime_FloatTime(void);
     21
    1922
    2023#ifdef __cplusplus
  • python/vendor/current/Include/token.h

    r2 r388  
    77extern "C" {
    88#endif
     9
     10#undef TILDE   /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */
    911
    1012#define ENDMARKER       0
  • python/vendor/current/Include/tupleobject.h

    r2 r388  
    4545PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t);
    4646PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
     47PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
    4748
    4849/* Macro, trading safety for speed */
  • python/vendor/current/Include/ucnhash.h

    r2 r388  
    77#endif
    88
    9 /* revised ucnhash CAPI interface (exported through a PyCObject) */
     9/* revised ucnhash CAPI interface (exported through a "wrapper") */
     10
     11#define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI"
    1012
    1113typedef struct {
  • python/vendor/current/Include/unicodeobject.h

    r2 r388  
    2929 * --------------------------------------------------------------------
    3030 * This Unicode String Type is
    31  * 
     31 *
    3232 * Copyright (c) 1999 by Secret Labs AB
    3333 * Copyright (c) 1999 by Fredrik Lundh
    34  * 
     34 *
    3535 * By obtaining, using, and/or copying this software and/or its
    3636 * associated documentation, you agree that you have read, understood,
    3737 * and will comply with the following terms and conditions:
    38  * 
     38 *
    3939 * Permission to use, copy, modify, and distribute this software and its
    4040 * associated documentation for any purpose and without fee is hereby
     
    4545 * distribution of the software without specific, written prior
    4646 * permission.
    47  * 
     47 *
    4848 * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO
    4949 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
     
    125125 * as single unsigned integer.
    126126 */
    127 #if SIZEOF_INT >= 4 
    128 typedef unsigned int Py_UCS4; 
     127#if SIZEOF_INT >= 4
     128typedef unsigned int Py_UCS4;
    129129#elif SIZEOF_LONG >= 4
    130 typedef unsigned long Py_UCS4; 
     130typedef unsigned long Py_UCS4;
    131131#endif
    132132
     
    362362 */
    363363#define Py_UNICODE_ISSPACE(ch) \
    364         ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
     364    ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
    365365
    366366#define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch)
     
    387387#define Py_UNICODE_ISALNUM(ch) \
    388388       (Py_UNICODE_ISALPHA(ch) || \
    389         Py_UNICODE_ISDECIMAL(ch) || \
    390         Py_UNICODE_ISDIGIT(ch) || \
    391         Py_UNICODE_ISNUMERIC(ch))
    392 
    393 #define Py_UNICODE_COPY(target, source, length)                         \
    394         Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE))
     389    Py_UNICODE_ISDECIMAL(ch) || \
     390    Py_UNICODE_ISDIGIT(ch) || \
     391    Py_UNICODE_ISNUMERIC(ch))
     392
     393#define Py_UNICODE_COPY(target, source, length)                         \
     394    Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE))
    395395
    396396#define Py_UNICODE_FILL(target, value, length) \
    397397    do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\
    398         for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
     398    for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
    399399    } while (0)
    400400
     
    415415typedef struct {
    416416    PyObject_HEAD
    417     Py_ssize_t length;          /* Length of raw Unicode data in buffer */
    418     Py_UNICODE *str;            /* Raw Unicode buffer */
    419     long hash;                  /* Hash value; -1 if not set */
    420     PyObject *defenc;           /* (Default) Encoded version as Python
    421                                    string, or NULL; this is used for
    422                                    implementing the buffer protocol */
     417    Py_ssize_t length;          /* Length of raw Unicode data in buffer */
     418    Py_UNICODE *str;            /* Raw Unicode buffer */
     419    long hash;                  /* Hash value; -1 if not set */
     420    PyObject *defenc;           /* (Default) Encoded version as Python
     421                                   string, or NULL; this is used for
     422                                   implementing the buffer protocol */
    423423} PyUnicodeObject;
    424424
     
    431431/* Fast access macros */
    432432#define PyUnicode_GET_SIZE(op) \
    433         (((PyUnicodeObject *)(op))->length)
     433    (((PyUnicodeObject *)(op))->length)
    434434#define PyUnicode_GET_DATA_SIZE(op) \
    435         (((PyUnicodeObject *)(op))->length * sizeof(Py_UNICODE))
     435    (((PyUnicodeObject *)(op))->length * sizeof(Py_UNICODE))
    436436#define PyUnicode_AS_UNICODE(op) \
    437         (((PyUnicodeObject *)(op))->str)
     437    (((PyUnicodeObject *)(op))->str)
    438438#define PyUnicode_AS_DATA(op) \
    439         ((const char *)((PyUnicodeObject *)(op))->str)
     439    ((const char *)((PyUnicodeObject *)(op))->str)
    440440
    441441/* --- Constants ---------------------------------------------------------- */
     
    453453
    454454/* Create a Unicode Object from the Py_UNICODE buffer u of the given
    455    size. 
     455   size.
    456456
    457457   u may be NULL which causes the contents to be undefined. It is the
     
    483483
    484484PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
    485     PyObject *unicode           /* Unicode object */
     485    PyObject *unicode           /* Unicode object */
    486486    );
    487487
     
    489489
    490490PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
    491     PyObject *unicode           /* Unicode object */
     491    PyObject *unicode           /* Unicode object */
    492492    );
    493493
     
    510510
    511511PyAPI_FUNC(int) PyUnicode_Resize(
    512     PyObject **unicode,         /* Pointer to the Unicode object */
    513     Py_ssize_t length           /* New length */
     512    PyObject **unicode,         /* Pointer to the Unicode object */
     513    Py_ssize_t length           /* New length */
    514514    );
    515515
     
    532532
    533533PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject(
    534     register PyObject *obj,     /* Object */
     534    register PyObject *obj,     /* Object */
    535535    const char *encoding,       /* encoding */
    536536    const char *errors          /* error handling */
     
    539539/* Coerce obj to an Unicode object and return a reference with
    540540   *incremented* refcount.
    541    
     541
    542542   Unicode objects are passed back as-is (subclasses are converted to
    543543   true Unicode objects), all other objects are delegated to
     
    551551
    552552PyAPI_FUNC(PyObject*) PyUnicode_FromObject(
    553     register PyObject *obj      /* Object */
     553    register PyObject *obj      /* Object */
    554554    );
    555555
     
    560560   (Advanced String Formatting). */
    561561PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj,
    562                                                 Py_UNICODE *format_spec,
    563                                                 Py_ssize_t format_spec_len);
     562                                                Py_UNICODE *format_spec,
     563                                                Py_ssize_t format_spec_len);
    564564
    565565/* --- wchar_t support for platforms which support it --------------------- */
     
    599599/* --- Unicode ordinals --------------------------------------------------- */
    600600
    601 /* Create a Unicode Object from the given Unicode code point ordinal. 
    602  
     601/* Create a Unicode Object from the given Unicode code point ordinal.
     602
    603603   The ordinal must be in range(0x10000) on narrow Python builds
    604604   (UCS2), and range(0x110000) on wide builds (UCS4). A ValueError is
     
    620620PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
    621621
    622 /* === Builtin Codecs ===================================================== 
     622/* === Builtin Codecs =====================================================
    623623
    624624   Many of these APIs take two arguments encoding and errors. These
    625625   parameters encoding and errors have the same semantics as the ones
    626    of the builtin unicode() API. 
     626   of the builtin unicode() API.
    627627
    628628   Setting encoding to NULL causes the default encoding to be used.
     
    641641
    642642/* Return a Python string holding the default encoded value of the
    643    Unicode object. 
     643   Unicode object.
    644644
    645645   The resulting string is cached in the Unicode object for subsequent
     
    663663   interpreter to become a parameter which is managed on a per-thread
    664664   basis.
    665    
     665
    666666 */
    667667
     
    671671
    672672   Returns 0 on success, -1 in case of an error.
    673    
     673
    674674 */
    675675
    676676PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding(
    677     const char *encoding        /* Encoding name in standard form */
     677    const char *encoding        /* Encoding name in standard form */
    678678    );
    679679
     
    690690    );
    691691
    692 /* Encodes a Py_UNICODE buffer of the given size and returns a 
     692/* Encodes a Py_UNICODE buffer of the given size and returns a
    693693   Python string object. */
    694694
     
    704704
    705705PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject(
    706     PyObject *unicode,          /* Unicode object */
    707     const char *encoding,       /* encoding */
    708     const char *errors          /* error handling */
     706    PyObject *unicode,          /* Unicode object */
     707    const char *encoding,       /* encoding */
     708    const char *errors          /* error handling */
    709709    );
    710710
     
    713713
    714714PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString(
    715     PyObject *unicode,          /* Unicode object */
    716     const char *encoding,       /* encoding */
    717     const char *errors          /* error handling */
     715    PyObject *unicode,          /* Unicode object */
     716    const char *encoding,       /* encoding */
     717    const char *errors          /* error handling */
    718718    );
    719719
     
    726726
    727727PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7(
    728     const char *string,         /* UTF-7 encoded string */
    729     Py_ssize_t length,          /* size of string */
    730     const char *errors          /* error handling */
     728    const char *string,         /* UTF-7 encoded string */
     729    Py_ssize_t length,          /* size of string */
     730    const char *errors          /* error handling */
    731731    );
    732732
    733733PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful(
    734     const char *string,         /* UTF-7 encoded string */
    735     Py_ssize_t length,          /* size of string */
    736     const char *errors,         /* error handling */
    737     Py_ssize_t *consumed        /* bytes consumed */
     734    const char *string,         /* UTF-7 encoded string */
     735    Py_ssize_t length,          /* size of string */
     736    const char *errors,         /* error handling */
     737    Py_ssize_t *consumed        /* bytes consumed */
    738738    );
    739739
    740740PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
    741     const Py_UNICODE *data,     /* Unicode char buffer */
    742     Py_ssize_t length,                  /* number of Py_UNICODE chars to encode */
    743     int encodeSetO,             /* force the encoder to encode characters in
    744                                    Set O, as described in RFC2152 */
    745     int encodeWhiteSpace,       /* force the encoder to encode space, tab,
    746                                    carriage return and linefeed characters */
    747     const char *errors          /* error handling */
     741    const Py_UNICODE *data,     /* Unicode char buffer */
     742    Py_ssize_t length,                  /* number of Py_UNICODE chars to encode */
     743    int base64SetO,             /* Encode RFC2152 Set O characters in base64 */
     744    int base64WhiteSpace,       /* Encode whitespace (sp, ht, nl, cr) in base64 */
     745    const char *errors          /* error handling */
    748746    );
    749747
     
    751749
    752750PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8(
    753     const char *string,         /* UTF-8 encoded string */
    754     Py_ssize_t length,          /* size of string */
    755     const char *errors          /* error handling */
     751    const char *string,         /* UTF-8 encoded string */
     752    Py_ssize_t length,          /* size of string */
     753    const char *errors          /* error handling */
    756754    );
    757755
    758756PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful(
    759     const char *string,         /* UTF-8 encoded string */
    760     Py_ssize_t length,          /* size of string */
    761     const char *errors,         /* error handling */
    762     Py_ssize_t *consumed                /* bytes consumed */
     757    const char *string,         /* UTF-8 encoded string */
     758    Py_ssize_t length,          /* size of string */
     759    const char *errors,         /* error handling */
     760    Py_ssize_t *consumed                /* bytes consumed */
    763761    );
    764762
    765763PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String(
    766     PyObject *unicode           /* Unicode object */
     764    PyObject *unicode           /* Unicode object */
    767765    );
    768766
    769767PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
    770     const Py_UNICODE *data,     /* Unicode char buffer */
    771     Py_ssize_t length,                  /* number of Py_UNICODE chars to encode */
    772     const char *errors          /* error handling */
     768    const Py_UNICODE *data,     /* Unicode char buffer */
     769    Py_ssize_t length,                  /* number of Py_UNICODE chars to encode */
     770    const char *errors          /* error handling */
    773771    );
    774772
     
    779777
    780778   errors (if non-NULL) defines the error handling. It defaults
    781    to "strict". 
     779   to "strict".
    782780
    783781   If byteorder is non-NULL, the decoder starts decoding using the
    784782   given byte order:
    785783
    786         *byteorder == -1: little endian
    787         *byteorder == 0:  native order
    788         *byteorder == 1:  big endian
     784    *byteorder == -1: little endian
     785    *byteorder == 0:  native order
     786    *byteorder == 1:  big endian
    789787
    790788   In native mode, the first four bytes of the stream are checked for a
     
    799797
    800798PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32(
    801     const char *string,         /* UTF-32 encoded string */
    802     Py_ssize_t length,          /* size of string */
    803     const char *errors,         /* error handling */
    804     int *byteorder              /* pointer to byteorder to use
    805                                    0=native;-1=LE,1=BE; updated on
    806                                    exit */
     799    const char *string,         /* UTF-32 encoded string */
     800    Py_ssize_t length,          /* size of string */
     801    const char *errors,         /* error handling */
     802    int *byteorder              /* pointer to byteorder to use
     803                                   0=native;-1=LE,1=BE; updated on
     804                                   exit */
    807805    );
    808806
    809807PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful(
    810     const char *string,         /* UTF-32 encoded string */
    811     Py_ssize_t length,          /* size of string */
    812     const char *errors,         /* error handling */
    813     int *byteorder,             /* pointer to byteorder to use
    814                                    0=native;-1=LE,1=BE; updated on
    815                                    exit */
    816     Py_ssize_t *consumed        /* bytes consumed */
     808    const char *string,         /* UTF-32 encoded string */
     809    Py_ssize_t length,          /* size of string */
     810    const char *errors,         /* error handling */
     811    int *byteorder,             /* pointer to byteorder to use
     812                                   0=native;-1=LE,1=BE; updated on
     813                                   exit */
     814    Py_ssize_t *consumed        /* bytes consumed */
    817815    );
    818816
     
    821819
    822820PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String(
    823     PyObject *unicode           /* Unicode object */
     821    PyObject *unicode           /* Unicode object */
    824822    );
    825823
     
    841839
    842840PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
    843     const Py_UNICODE *data,     /* Unicode char buffer */
    844     Py_ssize_t length,          /* number of Py_UNICODE chars to encode */
    845     const char *errors,         /* error handling */
    846     int byteorder               /* byteorder to use 0=BOM+native;-1=LE,1=BE */
     841    const Py_UNICODE *data,     /* Unicode char buffer */
     842    Py_ssize_t length,          /* number of Py_UNICODE chars to encode */
     843    const char *errors,         /* error handling */
     844    int byteorder               /* byteorder to use 0=BOM+native;-1=LE,1=BE */
    847845    );
    848846
     
    853851
    854852   errors (if non-NULL) defines the error handling. It defaults
    855    to "strict". 
     853   to "strict".
    856854
    857855   If byteorder is non-NULL, the decoder starts decoding using the
    858856   given byte order:
    859857
    860         *byteorder == -1: little endian
    861         *byteorder == 0:  native order
    862         *byteorder == 1:  big endian
     858    *byteorder == -1: little endian
     859    *byteorder == 0:  native order
     860    *byteorder == 1:  big endian
    863861
    864862   In native mode, the first two bytes of the stream are checked for a
     
    873871
    874872PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16(
    875     const char *string,         /* UTF-16 encoded string */
    876     Py_ssize_t length,          /* size of string */
    877     const char *errors,         /* error handling */
    878     int *byteorder              /* pointer to byteorder to use
    879                                    0=native;-1=LE,1=BE; updated on
    880                                    exit */
     873    const char *string,         /* UTF-16 encoded string */
     874    Py_ssize_t length,          /* size of string */
     875    const char *errors,         /* error handling */
     876    int *byteorder              /* pointer to byteorder to use
     877                                   0=native;-1=LE,1=BE; updated on
     878                                   exit */
    881879    );
    882880
    883881PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful(
    884     const char *string,         /* UTF-16 encoded string */
    885     Py_ssize_t length,          /* size of string */
    886     const char *errors,         /* error handling */
    887     int *byteorder,             /* pointer to byteorder to use
    888                                    0=native;-1=LE,1=BE; updated on
    889                                    exit */
    890     Py_ssize_t *consumed                /* bytes consumed */
     882    const char *string,         /* UTF-16 encoded string */
     883    Py_ssize_t length,          /* size of string */
     884    const char *errors,         /* error handling */
     885    int *byteorder,             /* pointer to byteorder to use
     886                                   0=native;-1=LE,1=BE; updated on
     887                                   exit */
     888    Py_ssize_t *consumed                /* bytes consumed */
    891889    );
    892890
     
    895893
    896894PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String(
    897     PyObject *unicode           /* Unicode object */
     895    PyObject *unicode           /* Unicode object */
    898896    );
    899897
     
    919917
    920918PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16(
    921     const Py_UNICODE *data,     /* Unicode char buffer */
    922     Py_ssize_t length,                  /* number of Py_UNICODE chars to encode */
    923     const char *errors,         /* error handling */
    924     int byteorder               /* byteorder to use 0=BOM+native;-1=LE,1=BE */
     919    const Py_UNICODE *data,     /* Unicode char buffer */
     920    Py_ssize_t length,                  /* number of Py_UNICODE chars to encode */
     921    const char *errors,         /* error handling */
     922    int byteorder               /* byteorder to use 0=BOM+native;-1=LE,1=BE */
    925923    );
    926924
     
    928926
    929927PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape(
    930     const char *string,         /* Unicode-Escape encoded string */
    931     Py_ssize_t length,          /* size of string */
    932     const char *errors          /* error handling */
     928    const char *string,         /* Unicode-Escape encoded string */
     929    Py_ssize_t length,          /* size of string */
     930    const char *errors          /* error handling */
    933931    );
    934932
    935933PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString(
    936     PyObject *unicode           /* Unicode object */
     934    PyObject *unicode           /* Unicode object */
    937935    );
    938936
    939937PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape(
    940     const Py_UNICODE *data,     /* Unicode char buffer */
    941     Py_ssize_t length                   /* Number of Py_UNICODE chars to encode */
     938    const Py_UNICODE *data,     /* Unicode char buffer */
     939    Py_ssize_t length                   /* Number of Py_UNICODE chars to encode */
    942940    );
    943941
     
    945943
    946944PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape(
    947     const char *string,         /* Raw-Unicode-Escape encoded string */
    948     Py_ssize_t length,          /* size of string */
    949     const char *errors          /* error handling */
     945    const char *string,         /* Raw-Unicode-Escape encoded string */
     946    Py_ssize_t length,          /* size of string */
     947    const char *errors          /* error handling */
    950948    );
    951949
    952950PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString(
    953     PyObject *unicode           /* Unicode object */
     951    PyObject *unicode           /* Unicode object */
    954952    );
    955953
    956954PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape(
    957     const Py_UNICODE *data,     /* Unicode char buffer */
    958     Py_ssize_t length                   /* Number of Py_UNICODE chars to encode */
     955    const Py_UNICODE *data,     /* Unicode char buffer */
     956    Py_ssize_t length                   /* Number of Py_UNICODE chars to encode */
    959957    );
    960958
     
    969967    );
    970968
    971 /* --- Latin-1 Codecs ----------------------------------------------------- 
     969/* --- Latin-1 Codecs -----------------------------------------------------
    972970
    973971   Note: Latin-1 corresponds to the first 256 Unicode ordinals.
     
    976974
    977975PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1(
    978     const char *string,         /* Latin-1 encoded string */
    979     Py_ssize_t length,          /* size of string */
    980     const char *errors          /* error handling */
     976    const char *string,         /* Latin-1 encoded string */
     977    Py_ssize_t length,          /* size of string */
     978    const char *errors          /* error handling */
    981979    );
    982980
    983981PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String(
    984     PyObject *unicode           /* Unicode object */
     982    PyObject *unicode           /* Unicode object */
    985983    );
    986984
    987985PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1(
    988     const Py_UNICODE *data,     /* Unicode char buffer */
    989     Py_ssize_t length,                  /* Number of Py_UNICODE chars to encode */
    990     const char *errors          /* error handling */
    991     );
    992 
    993 /* --- ASCII Codecs ------------------------------------------------------- 
     986    const Py_UNICODE *data,     /* Unicode char buffer */
     987    Py_ssize_t length,                  /* Number of Py_UNICODE chars to encode */
     988    const char *errors          /* error handling */
     989    );
     990
     991/* --- ASCII Codecs -------------------------------------------------------
    994992
    995993   Only 7-bit ASCII data is excepted. All other codes generate errors.
     
    998996
    999997PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII(
    1000     const char *string,         /* ASCII encoded string */
    1001     Py_ssize_t length,          /* size of string */
    1002     const char *errors          /* error handling */
     998    const char *string,         /* ASCII encoded string */
     999    Py_ssize_t length,          /* size of string */
     1000    const char *errors          /* error handling */
    10031001    );
    10041002
    10051003PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString(
    1006     PyObject *unicode           /* Unicode object */
     1004    PyObject *unicode           /* Unicode object */
    10071005    );
    10081006
    10091007PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII(
    1010     const Py_UNICODE *data,     /* Unicode char buffer */
    1011     Py_ssize_t length,                  /* Number of Py_UNICODE chars to encode */
    1012     const char *errors          /* error handling */
    1013     );
    1014 
    1015 /* --- Character Map Codecs ----------------------------------------------- 
    1016 
    1017    This codec uses mappings to encode and decode characters. 
     1008    const Py_UNICODE *data,     /* Unicode char buffer */
     1009    Py_ssize_t length,                  /* Number of Py_UNICODE chars to encode */
     1010    const char *errors          /* error handling */
     1011    );
     1012
     1013/* --- Character Map Codecs -----------------------------------------------
     1014
     1015   This codec uses mappings to encode and decode characters.
    10181016
    10191017   Decoding mappings must map single string characters to single
     
    10361034
    10371035PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap(
    1038     const char *string,         /* Encoded string */
    1039     Py_ssize_t length,          /* size of string */
    1040     PyObject *mapping,          /* character mapping
    1041                                    (char ordinal -> unicode ordinal) */
    1042     const char *errors          /* error handling */
     1036    const char *string,         /* Encoded string */
     1037    Py_ssize_t length,          /* size of string */
     1038    PyObject *mapping,          /* character mapping
     1039                                   (char ordinal -> unicode ordinal) */
     1040    const char *errors          /* error handling */
    10431041    );
    10441042
    10451043PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString(
    1046     PyObject *unicode,          /* Unicode object */
    1047     PyObject *mapping           /* character mapping
    1048                                    (unicode ordinal -> char ordinal) */
     1044    PyObject *unicode,          /* Unicode object */
     1045    PyObject *mapping           /* character mapping
     1046                                   (unicode ordinal -> char ordinal) */
    10491047    );
    10501048
    10511049PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap(
    1052     const Py_UNICODE *data,     /* Unicode char buffer */
    1053     Py_ssize_t length,          /* Number of Py_UNICODE chars to encode */
    1054     PyObject *mapping,          /* character mapping
    1055                                    (unicode ordinal -> char ordinal) */
    1056     const char *errors          /* error handling */
     1050    const Py_UNICODE *data,     /* Unicode char buffer */
     1051    Py_ssize_t length,          /* Number of Py_UNICODE chars to encode */
     1052    PyObject *mapping,          /* character mapping
     1053                                   (unicode ordinal -> char ordinal) */
     1054    const char *errors          /* error handling */
    10571055    );
    10581056
     
    10621060
    10631061   The mapping table must map Unicode ordinal integers to Unicode
    1064    ordinal integers or None (causing deletion of the character). 
     1062   ordinal integers or None (causing deletion of the character).
    10651063
    10661064   Mapping tables may be dictionaries or sequences. Unmapped character
     
    10711069
    10721070PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
    1073     const Py_UNICODE *data,     /* Unicode char buffer */
    1074     Py_ssize_t length,                  /* Number of Py_UNICODE chars to encode */
    1075     PyObject *table,            /* Translate table */
    1076     const char *errors          /* error handling */
     1071    const Py_UNICODE *data,     /* Unicode char buffer */
     1072    Py_ssize_t length,                  /* Number of Py_UNICODE chars to encode */
     1073    PyObject *table,            /* Translate table */
     1074    const char *errors          /* error handling */
    10771075    );
    10781076
     
    11231121      NULL or "strict": raise a ValueError
    11241122      "ignore": ignore the wrong characters (these are not copied to the
    1125                 output buffer)
     1123                output buffer)
    11261124      "replace": replaces illegal characters with '?'
    11271125
     
    11311129
    11321130PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
    1133     Py_UNICODE *s,              /* Unicode buffer */
    1134     Py_ssize_t length,                  /* Number of Py_UNICODE chars to encode */
    1135     char *output,               /* Output buffer; must have size >= length */
    1136     const char *errors          /* error handling */
     1131    Py_UNICODE *s,              /* Unicode buffer */
     1132    Py_ssize_t length,                  /* Number of Py_UNICODE chars to encode */
     1133    char *output,               /* Output buffer; must have size >= length */
     1134    const char *errors          /* error handling */
    11371135    );
    11381136
     
    11461144
    11471145PyAPI_FUNC(PyObject*) PyUnicode_Concat(
    1148     PyObject *left,             /* Left string */
    1149     PyObject *right             /* Right string */
     1146    PyObject *left,             /* Left string */
     1147    PyObject *right             /* Right string */
    11501148    );
    11511149
     
    11621160
    11631161PyAPI_FUNC(PyObject*) PyUnicode_Split(
    1164     PyObject *s,                /* String to split */
    1165     PyObject *sep,              /* String separator */
    1166     Py_ssize_t maxsplit         /* Maxsplit count */
    1167     );         
     1162    PyObject *s,                /* String to split */
     1163    PyObject *sep,              /* String separator */
     1164    Py_ssize_t maxsplit         /* Maxsplit count */
     1165    );
    11681166
    11691167/* Dito, but split at line breaks.
     
    11711169   CRLF is considered to be one line break. Line breaks are not
    11721170   included in the resulting list. */
    1173    
     1171
    11741172PyAPI_FUNC(PyObject*) PyUnicode_Splitlines(
    1175     PyObject *s,                /* String to split */
    1176     int keepends                /* If true, line end markers are included */
    1177     );         
     1173    PyObject *s,                /* String to split */
     1174    int keepends                /* If true, line end markers are included */
     1175    );
    11781176
    11791177/* Partition a string using a given separator. */
    11801178
    11811179PyAPI_FUNC(PyObject*) PyUnicode_Partition(
    1182     PyObject *s,                /* String to partition */
    1183     PyObject *sep               /* String separator */
    1184     );         
     1180    PyObject *s,                /* String to partition */
     1181    PyObject *sep               /* String separator */
     1182    );
    11851183
    11861184/* Partition a string using a given separator, searching from the end of the
     
    11881186
    11891187PyAPI_FUNC(PyObject*) PyUnicode_RPartition(
    1190     PyObject *s,                /* String to partition */
    1191     PyObject *sep               /* String separator */
    1192     );         
     1188    PyObject *s,                /* String to partition */
     1189    PyObject *sep               /* String separator */
     1190    );
    11931191
    11941192/* Split a string giving a list of Unicode strings.
     
    12061204
    12071205PyAPI_FUNC(PyObject*) PyUnicode_RSplit(
    1208     PyObject *s,                /* String to split */
    1209     PyObject *sep,              /* String separator */
    1210     Py_ssize_t maxsplit         /* Maxsplit count */
    1211     );         
     1206    PyObject *s,                /* String to split */
     1207    PyObject *sep,              /* String separator */
     1208    Py_ssize_t maxsplit         /* Maxsplit count */
     1209    );
    12121210
    12131211/* Translate a string by applying a character mapping table to it and
     
    12151213
    12161214   The mapping table must map Unicode ordinal integers to Unicode
    1217    ordinal integers or None (causing deletion of the character). 
     1215   ordinal integers or None (causing deletion of the character).
    12181216
    12191217   Mapping tables may be dictionaries or sequences. Unmapped character
     
    12241222
    12251223PyAPI_FUNC(PyObject *) PyUnicode_Translate(
    1226     PyObject *str,              /* String */
    1227     PyObject *table,            /* Translate table */
    1228     const char *errors          /* error handling */
     1224    PyObject *str,              /* String */
     1225    PyObject *table,            /* Translate table */
     1226    const char *errors          /* error handling */
    12291227    );
    12301228
    12311229/* Join a sequence of strings using the given separator and return
    12321230   the resulting Unicode string. */
    1233    
     1231
    12341232PyAPI_FUNC(PyObject*) PyUnicode_Join(
    1235     PyObject *separator,        /* Separator string */
    1236     PyObject *seq               /* Sequence object */
     1233    PyObject *separator,        /* Separator string */
     1234    PyObject *seq               /* Sequence object */
    12371235    );
    12381236
     
    12411239
    12421240PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch(
    1243     PyObject *str,              /* String */
    1244     PyObject *substr,           /* Prefix or Suffix string */
    1245     Py_ssize_t start,           /* Start index */
    1246     Py_ssize_t end,             /* Stop index */
    1247     int direction               /* Tail end: -1 prefix, +1 suffix */
     1241    PyObject *str,              /* String */
     1242    PyObject *substr,           /* Prefix or Suffix string */
     1243    Py_ssize_t start,           /* Start index */
     1244    Py_ssize_t end,             /* Stop index */
     1245    int direction               /* Tail end: -1 prefix, +1 suffix */
    12481246    );
    12491247
     
    12531251
    12541252PyAPI_FUNC(Py_ssize_t) PyUnicode_Find(
    1255     PyObject *str,              /* String */
    1256     PyObject *substr,           /* Substring to find */
    1257     Py_ssize_t start,           /* Start index */
    1258     Py_ssize_t end,             /* Stop index */
    1259     int direction               /* Find direction: +1 forward, -1 backward */
     1253    PyObject *str,              /* String */
     1254    PyObject *substr,           /* Substring to find */
     1255    Py_ssize_t start,           /* Start index */
     1256    Py_ssize_t end,             /* Stop index */
     1257    int direction               /* Find direction: +1 forward, -1 backward */
    12601258    );
    12611259
     
    12631261
    12641262PyAPI_FUNC(Py_ssize_t) PyUnicode_Count(
    1265     PyObject *str,              /* String */
    1266     PyObject *substr,           /* Substring to count */
    1267     Py_ssize_t start,           /* Start index */
    1268     Py_ssize_t end              /* Stop index */
     1263    PyObject *str,              /* String */
     1264    PyObject *substr,           /* Substring to count */
     1265    Py_ssize_t start,           /* Start index */
     1266    Py_ssize_t end              /* Stop index */
    12691267    );
    12701268
     
    12731271
    12741272PyAPI_FUNC(PyObject *) PyUnicode_Replace(
    1275     PyObject *str,              /* String */
    1276     PyObject *substr,           /* Substring to find */
    1277     PyObject *replstr,          /* Substring to replace */
    1278     Py_ssize_t maxcount         /* Max. number of replacements to apply;
    1279                                    -1 = all */
     1273    PyObject *str,              /* String */
     1274    PyObject *substr,           /* Substring to find */
     1275    PyObject *replstr,          /* Substring to replace */
     1276    Py_ssize_t maxcount         /* Max. number of replacements to apply;
     1277                                   -1 = all */
    12801278    );
    12811279
     
    12841282
    12851283PyAPI_FUNC(int) PyUnicode_Compare(
    1286     PyObject *left,             /* Left string */
    1287     PyObject *right             /* Right string */
     1284    PyObject *left,             /* Left string */
     1285    PyObject *right             /* Right string */
    12881286    );
    12891287
     
    13051303
    13061304PyAPI_FUNC(PyObject *) PyUnicode_RichCompare(
    1307     PyObject *left,             /* Left string */
    1308     PyObject *right,            /* Right string */
    1309     int op                      /* Operation: Py_EQ, Py_NE, Py_GT, etc. */
     1305    PyObject *left,             /* Left string */
     1306    PyObject *right,            /* Right string */
     1307    int op                      /* Operation: Py_EQ, Py_NE, Py_GT, etc. */
    13101308    );
    13111309
     
    13141312
    13151313PyAPI_FUNC(PyObject *) PyUnicode_Format(
    1316     PyObject *format,           /* Format string */
    1317     PyObject *args              /* Argument tuple or dictionary */
     1314    PyObject *format,           /* Format string */
     1315    PyObject *args              /* Argument tuple or dictionary */
    13181316    );
    13191317
     
    13251323
    13261324PyAPI_FUNC(int) PyUnicode_Contains(
    1327     PyObject *container,        /* Container string */
    1328     PyObject *element           /* Element string */
     1325    PyObject *container,        /* Container string */
     1326    PyObject *element           /* Element string */
    13291327    );
    13301328
     
    13431341
    13441342/* These should not be used directly. Use the Py_UNICODE_IS* and
    1345    Py_UNICODE_TO* macros instead. 
     1343   Py_UNICODE_TO* macros instead.
    13461344
    13471345   These APIs are implemented in Objects/unicodectype.c.
     
    13501348
    13511349PyAPI_FUNC(int) _PyUnicode_IsLowercase(
    1352     Py_UNICODE ch       /* Unicode character */
     1350    Py_UNICODE ch       /* Unicode character */
    13531351    );
    13541352
    13551353PyAPI_FUNC(int) _PyUnicode_IsUppercase(
    1356     Py_UNICODE ch       /* Unicode character */
     1354    Py_UNICODE ch       /* Unicode character */
    13571355    );
    13581356
    13591357PyAPI_FUNC(int) _PyUnicode_IsTitlecase(
    1360     Py_UNICODE ch       /* Unicode character */
     1358    Py_UNICODE ch       /* Unicode character */
    13611359    );
    13621360
    13631361PyAPI_FUNC(int) _PyUnicode_IsWhitespace(
    1364     const Py_UNICODE ch         /* Unicode character */
     1362    const Py_UNICODE ch         /* Unicode character */
    13651363    );
    13661364
    13671365PyAPI_FUNC(int) _PyUnicode_IsLinebreak(
    1368     const Py_UNICODE ch         /* Unicode character */
     1366    const Py_UNICODE ch         /* Unicode character */
    13691367    );
    13701368
    13711369PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase(
    1372     Py_UNICODE ch       /* Unicode character */
     1370    Py_UNICODE ch       /* Unicode character */
    13731371    );
    13741372
    13751373PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase(
    1376     Py_UNICODE ch       /* Unicode character */
     1374    Py_UNICODE ch       /* Unicode character */
    13771375    );
    13781376
    13791377PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase(
    1380     Py_UNICODE ch       /* Unicode character */
     1378    Py_UNICODE ch       /* Unicode character */
    13811379    );
    13821380
    13831381PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit(
    1384     Py_UNICODE ch       /* Unicode character */
     1382    Py_UNICODE ch       /* Unicode character */
    13851383    );
    13861384
    13871385PyAPI_FUNC(int) _PyUnicode_ToDigit(
    1388     Py_UNICODE ch       /* Unicode character */
     1386    Py_UNICODE ch       /* Unicode character */
    13891387    );
    13901388
    13911389PyAPI_FUNC(double) _PyUnicode_ToNumeric(
    1392     Py_UNICODE ch       /* Unicode character */
     1390    Py_UNICODE ch       /* Unicode character */
    13931391    );
    13941392
    13951393PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit(
    1396     Py_UNICODE ch       /* Unicode character */
     1394    Py_UNICODE ch       /* Unicode character */
    13971395    );
    13981396
    13991397PyAPI_FUNC(int) _PyUnicode_IsDigit(
    1400     Py_UNICODE ch       /* Unicode character */
     1398    Py_UNICODE ch       /* Unicode character */
    14011399    );
    14021400
    14031401PyAPI_FUNC(int) _PyUnicode_IsNumeric(
    1404     Py_UNICODE ch       /* Unicode character */
     1402    Py_UNICODE ch       /* Unicode character */
    14051403    );
    14061404
    14071405PyAPI_FUNC(int) _PyUnicode_IsAlpha(
    1408     Py_UNICODE ch       /* Unicode character */
     1406    Py_UNICODE ch       /* Unicode character */
    14091407    );
    14101408
  • python/vendor/current/Include/weakrefobject.h

    r2 r388  
    5050         (Py_TYPE(op) == &_PyWeakref_CallableProxyType))
    5151
    52 /* This macro calls PyWeakref_CheckRef() last since that can involve a
    53    function call; this makes it more likely that the function call
    54    will be avoided. */
    5552#define PyWeakref_Check(op) \
    5653        (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))
     
    6764PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
    6865
    69 #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object)
     66/* Explanation for the Py_REFCNT() check: when a weakref's target is part
     67   of a long chain of deallocations which triggers the trashcan mechanism,
     68   clearing the weakrefs can be delayed long after the target's refcount
     69   has dropped to zero.  In the meantime, code accessing the weakref will
     70   be able to "see" the target object even though it is supposed to be
     71   unreachable.  See issue #16602. */
     72
     73#define PyWeakref_GET_OBJECT(ref)                           \
     74    (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0   \
     75     ? ((PyWeakReference *)(ref))->wr_object                \
     76     : Py_None)
    7077
    7178
Note: See TracChangeset for help on using the changeset viewer.