Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/python3....
File: object.h
#ifndef Py_OBJECT_H
[0] Fix | Delete
#define Py_OBJECT_H
[1] Fix | Delete
#ifdef __cplusplus
[2] Fix | Delete
extern "C" {
[3] Fix | Delete
#endif
[4] Fix | Delete
[5] Fix | Delete
[6] Fix | Delete
/* Object and type object interface */
[7] Fix | Delete
[8] Fix | Delete
/*
[9] Fix | Delete
Objects are structures allocated on the heap. Special rules apply to
[10] Fix | Delete
the use of objects to ensure they are properly garbage-collected.
[11] Fix | Delete
Objects are never allocated statically or on the stack; they must be
[12] Fix | Delete
accessed through special macros and functions only. (Type objects are
[13] Fix | Delete
exceptions to the first rule; the standard types are represented by
[14] Fix | Delete
statically initialized type objects, although work on type/class unification
[15] Fix | Delete
for Python 2.2 made it possible to have heap-allocated type objects too).
[16] Fix | Delete
[17] Fix | Delete
An object has a 'reference count' that is increased or decreased when a
[18] Fix | Delete
pointer to the object is copied or deleted; when the reference count
[19] Fix | Delete
reaches zero there are no references to the object left and it can be
[20] Fix | Delete
removed from the heap.
[21] Fix | Delete
[22] Fix | Delete
An object has a 'type' that determines what it represents and what kind
[23] Fix | Delete
of data it contains. An object's type is fixed when it is created.
[24] Fix | Delete
Types themselves are represented as objects; an object contains a
[25] Fix | Delete
pointer to the corresponding type object. The type itself has a type
[26] Fix | Delete
pointer pointing to the object representing the type 'type', which
[27] Fix | Delete
contains a pointer to itself!).
[28] Fix | Delete
[29] Fix | Delete
Objects do not float around in memory; once allocated an object keeps
[30] Fix | Delete
the same size and address. Objects that must hold variable-size data
[31] Fix | Delete
can contain pointers to variable-size parts of the object. Not all
[32] Fix | Delete
objects of the same type have the same size; but the size cannot change
[33] Fix | Delete
after allocation. (These restrictions are made so a reference to an
[34] Fix | Delete
object can be simply a pointer -- moving an object would require
[35] Fix | Delete
updating all the pointers, and changing an object's size would require
[36] Fix | Delete
moving it if there was another object right next to it.)
[37] Fix | Delete
[38] Fix | Delete
Objects are always accessed through pointers of the type 'PyObject *'.
[39] Fix | Delete
The type 'PyObject' is a structure that only contains the reference count
[40] Fix | Delete
and the type pointer. The actual memory allocated for an object
[41] Fix | Delete
contains other data that can only be accessed after casting the pointer
[42] Fix | Delete
to a pointer to a longer structure type. This longer type must start
[43] Fix | Delete
with the reference count and type fields; the macro PyObject_HEAD should be
[44] Fix | Delete
used for this (to accommodate for future changes). The implementation
[45] Fix | Delete
of a particular object type can cast the object pointer to the proper
[46] Fix | Delete
type and back.
[47] Fix | Delete
[48] Fix | Delete
A standard interface exists for objects that contain an array of items
[49] Fix | Delete
whose size is determined when the object is allocated.
[50] Fix | Delete
*/
[51] Fix | Delete
[52] Fix | Delete
/* Py_DEBUG implies Py_TRACE_REFS. */
[53] Fix | Delete
#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS)
[54] Fix | Delete
#define Py_TRACE_REFS
[55] Fix | Delete
#endif
[56] Fix | Delete
[57] Fix | Delete
/* Py_TRACE_REFS implies Py_REF_DEBUG. */
[58] Fix | Delete
#if defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG)
[59] Fix | Delete
#define Py_REF_DEBUG
[60] Fix | Delete
#endif
[61] Fix | Delete
[62] Fix | Delete
#if defined(Py_LIMITED_API) && defined(Py_REF_DEBUG)
[63] Fix | Delete
#error Py_LIMITED_API is incompatible with Py_DEBUG, Py_TRACE_REFS, and Py_REF_DEBUG
[64] Fix | Delete
#endif
[65] Fix | Delete
[66] Fix | Delete
[67] Fix | Delete
#ifdef Py_TRACE_REFS
[68] Fix | Delete
/* Define pointers to support a doubly-linked list of all live heap objects. */
[69] Fix | Delete
#define _PyObject_HEAD_EXTRA \
[70] Fix | Delete
struct _object *_ob_next; \
[71] Fix | Delete
struct _object *_ob_prev;
[72] Fix | Delete
[73] Fix | Delete
#define _PyObject_EXTRA_INIT 0, 0,
[74] Fix | Delete
[75] Fix | Delete
#else
[76] Fix | Delete
#define _PyObject_HEAD_EXTRA
[77] Fix | Delete
#define _PyObject_EXTRA_INIT
[78] Fix | Delete
#endif
[79] Fix | Delete
[80] Fix | Delete
/* PyObject_HEAD defines the initial segment of every PyObject. */
[81] Fix | Delete
#define PyObject_HEAD PyObject ob_base;
[82] Fix | Delete
[83] Fix | Delete
#define PyObject_HEAD_INIT(type) \
[84] Fix | Delete
{ _PyObject_EXTRA_INIT \
[85] Fix | Delete
1, type },
[86] Fix | Delete
[87] Fix | Delete
#define PyVarObject_HEAD_INIT(type, size) \
[88] Fix | Delete
{ PyObject_HEAD_INIT(type) size },
[89] Fix | Delete
[90] Fix | Delete
/* PyObject_VAR_HEAD defines the initial segment of all variable-size
[91] Fix | Delete
* container objects. These end with a declaration of an array with 1
[92] Fix | Delete
* element, but enough space is malloc'ed so that the array actually
[93] Fix | Delete
* has room for ob_size elements. Note that ob_size is an element count,
[94] Fix | Delete
* not necessarily a byte count.
[95] Fix | Delete
*/
[96] Fix | Delete
#define PyObject_VAR_HEAD PyVarObject ob_base;
[97] Fix | Delete
#define Py_INVALID_SIZE (Py_ssize_t)-1
[98] Fix | Delete
[99] Fix | Delete
/* Nothing is actually declared to be a PyObject, but every pointer to
[100] Fix | Delete
* a Python object can be cast to a PyObject*. This is inheritance built
[101] Fix | Delete
* by hand. Similarly every pointer to a variable-size Python object can,
[102] Fix | Delete
* in addition, be cast to PyVarObject*.
[103] Fix | Delete
*/
[104] Fix | Delete
typedef struct _object {
[105] Fix | Delete
_PyObject_HEAD_EXTRA
[106] Fix | Delete
Py_ssize_t ob_refcnt;
[107] Fix | Delete
struct _typeobject *ob_type;
[108] Fix | Delete
} PyObject;
[109] Fix | Delete
[110] Fix | Delete
typedef struct {
[111] Fix | Delete
PyObject ob_base;
[112] Fix | Delete
Py_ssize_t ob_size; /* Number of items in variable part */
[113] Fix | Delete
} PyVarObject;
[114] Fix | Delete
[115] Fix | Delete
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
[116] Fix | Delete
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
[117] Fix | Delete
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
[118] Fix | Delete
[119] Fix | Delete
#ifndef Py_LIMITED_API
[120] Fix | Delete
/********************* String Literals ****************************************/
[121] Fix | Delete
/* This structure helps managing static strings. The basic usage goes like this:
[122] Fix | Delete
Instead of doing
[123] Fix | Delete
[124] Fix | Delete
r = PyObject_CallMethod(o, "foo", "args", ...);
[125] Fix | Delete
[126] Fix | Delete
do
[127] Fix | Delete
[128] Fix | Delete
_Py_IDENTIFIER(foo);
[129] Fix | Delete
...
[130] Fix | Delete
r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...);
[131] Fix | Delete
[132] Fix | Delete
PyId_foo is a static variable, either on block level or file level. On first
[133] Fix | Delete
usage, the string "foo" is interned, and the structures are linked. On interpreter
[134] Fix | Delete
shutdown, all strings are released (through _PyUnicode_ClearStaticStrings).
[135] Fix | Delete
[136] Fix | Delete
Alternatively, _Py_static_string allows choosing the variable name.
[137] Fix | Delete
_PyUnicode_FromId returns a borrowed reference to the interned string.
[138] Fix | Delete
_PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*.
[139] Fix | Delete
*/
[140] Fix | Delete
typedef struct _Py_Identifier {
[141] Fix | Delete
struct _Py_Identifier *next;
[142] Fix | Delete
const char* string;
[143] Fix | Delete
PyObject *object;
[144] Fix | Delete
} _Py_Identifier;
[145] Fix | Delete
[146] Fix | Delete
#define _Py_static_string_init(value) { .next = NULL, .string = value, .object = NULL }
[147] Fix | Delete
#define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value)
[148] Fix | Delete
#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)
[149] Fix | Delete
[150] Fix | Delete
#endif /* !Py_LIMITED_API */
[151] Fix | Delete
[152] Fix | Delete
/*
[153] Fix | Delete
Type objects contain a string containing the type name (to help somewhat
[154] Fix | Delete
in debugging), the allocation parameters (see PyObject_New() and
[155] Fix | Delete
PyObject_NewVar()),
[156] Fix | Delete
and methods for accessing objects of the type. Methods are optional, a
[157] Fix | Delete
nil pointer meaning that particular kind of access is not available for
[158] Fix | Delete
this type. The Py_DECREF() macro uses the tp_dealloc method without
[159] Fix | Delete
checking for a nil pointer; it should always be implemented except if
[160] Fix | Delete
the implementation can guarantee that the reference count will never
[161] Fix | Delete
reach zero (e.g., for statically allocated type objects).
[162] Fix | Delete
[163] Fix | Delete
NB: the methods for certain type groups are now contained in separate
[164] Fix | Delete
method blocks.
[165] Fix | Delete
*/
[166] Fix | Delete
[167] Fix | Delete
typedef PyObject * (*unaryfunc)(PyObject *);
[168] Fix | Delete
typedef PyObject * (*binaryfunc)(PyObject *, PyObject *);
[169] Fix | Delete
typedef PyObject * (*ternaryfunc)(PyObject *, PyObject *, PyObject *);
[170] Fix | Delete
typedef int (*inquiry)(PyObject *);
[171] Fix | Delete
typedef Py_ssize_t (*lenfunc)(PyObject *);
[172] Fix | Delete
typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t);
[173] Fix | Delete
typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t);
[174] Fix | Delete
typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *);
[175] Fix | Delete
typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
[176] Fix | Delete
typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *);
[177] Fix | Delete
[178] Fix | Delete
#ifndef Py_LIMITED_API
[179] Fix | Delete
/* buffer interface */
[180] Fix | Delete
typedef struct bufferinfo {
[181] Fix | Delete
void *buf;
[182] Fix | Delete
PyObject *obj; /* owned reference */
[183] Fix | Delete
Py_ssize_t len;
[184] Fix | Delete
Py_ssize_t itemsize; /* This is Py_ssize_t so it can be
[185] Fix | Delete
pointed to by strides in simple case.*/
[186] Fix | Delete
int readonly;
[187] Fix | Delete
int ndim;
[188] Fix | Delete
char *format;
[189] Fix | Delete
Py_ssize_t *shape;
[190] Fix | Delete
Py_ssize_t *strides;
[191] Fix | Delete
Py_ssize_t *suboffsets;
[192] Fix | Delete
void *internal;
[193] Fix | Delete
} Py_buffer;
[194] Fix | Delete
[195] Fix | Delete
typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
[196] Fix | Delete
typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
[197] Fix | Delete
[198] Fix | Delete
/* Maximum number of dimensions */
[199] Fix | Delete
#define PyBUF_MAX_NDIM 64
[200] Fix | Delete
[201] Fix | Delete
/* Flags for getting buffers */
[202] Fix | Delete
#define PyBUF_SIMPLE 0
[203] Fix | Delete
#define PyBUF_WRITABLE 0x0001
[204] Fix | Delete
/* we used to include an E, backwards compatible alias */
[205] Fix | Delete
#define PyBUF_WRITEABLE PyBUF_WRITABLE
[206] Fix | Delete
#define PyBUF_FORMAT 0x0004
[207] Fix | Delete
#define PyBUF_ND 0x0008
[208] Fix | Delete
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
[209] Fix | Delete
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
[210] Fix | Delete
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
[211] Fix | Delete
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
[212] Fix | Delete
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
[213] Fix | Delete
[214] Fix | Delete
#define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE)
[215] Fix | Delete
#define PyBUF_CONTIG_RO (PyBUF_ND)
[216] Fix | Delete
[217] Fix | Delete
#define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE)
[218] Fix | Delete
#define PyBUF_STRIDED_RO (PyBUF_STRIDES)
[219] Fix | Delete
[220] Fix | Delete
#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT)
[221] Fix | Delete
#define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT)
[222] Fix | Delete
[223] Fix | Delete
#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT)
[224] Fix | Delete
#define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT)
[225] Fix | Delete
[226] Fix | Delete
[227] Fix | Delete
#define PyBUF_READ 0x100
[228] Fix | Delete
#define PyBUF_WRITE 0x200
[229] Fix | Delete
[230] Fix | Delete
/* End buffer interface */
[231] Fix | Delete
#endif /* Py_LIMITED_API */
[232] Fix | Delete
[233] Fix | Delete
typedef int (*objobjproc)(PyObject *, PyObject *);
[234] Fix | Delete
typedef int (*visitproc)(PyObject *, void *);
[235] Fix | Delete
typedef int (*traverseproc)(PyObject *, visitproc, void *);
[236] Fix | Delete
[237] Fix | Delete
#ifndef Py_LIMITED_API
[238] Fix | Delete
typedef struct {
[239] Fix | Delete
/* Number implementations must check *both*
[240] Fix | Delete
arguments for proper type and implement the necessary conversions
[241] Fix | Delete
in the slot functions themselves. */
[242] Fix | Delete
[243] Fix | Delete
binaryfunc nb_add;
[244] Fix | Delete
binaryfunc nb_subtract;
[245] Fix | Delete
binaryfunc nb_multiply;
[246] Fix | Delete
binaryfunc nb_remainder;
[247] Fix | Delete
binaryfunc nb_divmod;
[248] Fix | Delete
ternaryfunc nb_power;
[249] Fix | Delete
unaryfunc nb_negative;
[250] Fix | Delete
unaryfunc nb_positive;
[251] Fix | Delete
unaryfunc nb_absolute;
[252] Fix | Delete
inquiry nb_bool;
[253] Fix | Delete
unaryfunc nb_invert;
[254] Fix | Delete
binaryfunc nb_lshift;
[255] Fix | Delete
binaryfunc nb_rshift;
[256] Fix | Delete
binaryfunc nb_and;
[257] Fix | Delete
binaryfunc nb_xor;
[258] Fix | Delete
binaryfunc nb_or;
[259] Fix | Delete
unaryfunc nb_int;
[260] Fix | Delete
void *nb_reserved; /* the slot formerly known as nb_long */
[261] Fix | Delete
unaryfunc nb_float;
[262] Fix | Delete
[263] Fix | Delete
binaryfunc nb_inplace_add;
[264] Fix | Delete
binaryfunc nb_inplace_subtract;
[265] Fix | Delete
binaryfunc nb_inplace_multiply;
[266] Fix | Delete
binaryfunc nb_inplace_remainder;
[267] Fix | Delete
ternaryfunc nb_inplace_power;
[268] Fix | Delete
binaryfunc nb_inplace_lshift;
[269] Fix | Delete
binaryfunc nb_inplace_rshift;
[270] Fix | Delete
binaryfunc nb_inplace_and;
[271] Fix | Delete
binaryfunc nb_inplace_xor;
[272] Fix | Delete
binaryfunc nb_inplace_or;
[273] Fix | Delete
[274] Fix | Delete
binaryfunc nb_floor_divide;
[275] Fix | Delete
binaryfunc nb_true_divide;
[276] Fix | Delete
binaryfunc nb_inplace_floor_divide;
[277] Fix | Delete
binaryfunc nb_inplace_true_divide;
[278] Fix | Delete
[279] Fix | Delete
unaryfunc nb_index;
[280] Fix | Delete
[281] Fix | Delete
binaryfunc nb_matrix_multiply;
[282] Fix | Delete
binaryfunc nb_inplace_matrix_multiply;
[283] Fix | Delete
} PyNumberMethods;
[284] Fix | Delete
[285] Fix | Delete
typedef struct {
[286] Fix | Delete
lenfunc sq_length;
[287] Fix | Delete
binaryfunc sq_concat;
[288] Fix | Delete
ssizeargfunc sq_repeat;
[289] Fix | Delete
ssizeargfunc sq_item;
[290] Fix | Delete
void *was_sq_slice;
[291] Fix | Delete
ssizeobjargproc sq_ass_item;
[292] Fix | Delete
void *was_sq_ass_slice;
[293] Fix | Delete
objobjproc sq_contains;
[294] Fix | Delete
[295] Fix | Delete
binaryfunc sq_inplace_concat;
[296] Fix | Delete
ssizeargfunc sq_inplace_repeat;
[297] Fix | Delete
} PySequenceMethods;
[298] Fix | Delete
[299] Fix | Delete
typedef struct {
[300] Fix | Delete
lenfunc mp_length;
[301] Fix | Delete
binaryfunc mp_subscript;
[302] Fix | Delete
objobjargproc mp_ass_subscript;
[303] Fix | Delete
} PyMappingMethods;
[304] Fix | Delete
[305] Fix | Delete
typedef struct {
[306] Fix | Delete
unaryfunc am_await;
[307] Fix | Delete
unaryfunc am_aiter;
[308] Fix | Delete
unaryfunc am_anext;
[309] Fix | Delete
} PyAsyncMethods;
[310] Fix | Delete
[311] Fix | Delete
typedef struct {
[312] Fix | Delete
getbufferproc bf_getbuffer;
[313] Fix | Delete
releasebufferproc bf_releasebuffer;
[314] Fix | Delete
} PyBufferProcs;
[315] Fix | Delete
#endif /* Py_LIMITED_API */
[316] Fix | Delete
[317] Fix | Delete
typedef void (*freefunc)(void *);
[318] Fix | Delete
typedef void (*destructor)(PyObject *);
[319] Fix | Delete
#ifndef Py_LIMITED_API
[320] Fix | Delete
/* We can't provide a full compile-time check that limited-API
[321] Fix | Delete
users won't implement tp_print. However, not defining printfunc
[322] Fix | Delete
and making tp_print of a different function pointer type
[323] Fix | Delete
should at least cause a warning in most cases. */
[324] Fix | Delete
typedef int (*printfunc)(PyObject *, FILE *, int);
[325] Fix | Delete
#endif
[326] Fix | Delete
typedef PyObject *(*getattrfunc)(PyObject *, char *);
[327] Fix | Delete
typedef PyObject *(*getattrofunc)(PyObject *, PyObject *);
[328] Fix | Delete
typedef int (*setattrfunc)(PyObject *, char *, PyObject *);
[329] Fix | Delete
typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *);
[330] Fix | Delete
typedef PyObject *(*reprfunc)(PyObject *);
[331] Fix | Delete
typedef Py_hash_t (*hashfunc)(PyObject *);
[332] Fix | Delete
typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int);
[333] Fix | Delete
typedef PyObject *(*getiterfunc) (PyObject *);
[334] Fix | Delete
typedef PyObject *(*iternextfunc) (PyObject *);
[335] Fix | Delete
typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *, PyObject *);
[336] Fix | Delete
typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *);
[337] Fix | Delete
typedef int (*initproc)(PyObject *, PyObject *, PyObject *);
[338] Fix | Delete
typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *);
[339] Fix | Delete
typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t);
[340] Fix | Delete
[341] Fix | Delete
#ifdef Py_LIMITED_API
[342] Fix | Delete
typedef struct _typeobject PyTypeObject; /* opaque */
[343] Fix | Delete
#else
[344] Fix | Delete
typedef struct _typeobject {
[345] Fix | Delete
PyObject_VAR_HEAD
[346] Fix | Delete
const char *tp_name; /* For printing, in format "<module>.<name>" */
[347] Fix | Delete
Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */
[348] Fix | Delete
[349] Fix | Delete
/* Methods to implement standard operations */
[350] Fix | Delete
[351] Fix | Delete
destructor tp_dealloc;
[352] Fix | Delete
printfunc tp_print;
[353] Fix | Delete
getattrfunc tp_getattr;
[354] Fix | Delete
setattrfunc tp_setattr;
[355] Fix | Delete
PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
[356] Fix | Delete
or tp_reserved (Python 3) */
[357] Fix | Delete
reprfunc tp_repr;
[358] Fix | Delete
[359] Fix | Delete
/* Method suites for standard classes */
[360] Fix | Delete
[361] Fix | Delete
PyNumberMethods *tp_as_number;
[362] Fix | Delete
PySequenceMethods *tp_as_sequence;
[363] Fix | Delete
PyMappingMethods *tp_as_mapping;
[364] Fix | Delete
[365] Fix | Delete
/* More standard operations (here for binary compatibility) */
[366] Fix | Delete
[367] Fix | Delete
hashfunc tp_hash;
[368] Fix | Delete
ternaryfunc tp_call;
[369] Fix | Delete
reprfunc tp_str;
[370] Fix | Delete
getattrofunc tp_getattro;
[371] Fix | Delete
setattrofunc tp_setattro;
[372] Fix | Delete
[373] Fix | Delete
/* Functions to access object as input/output buffer */
[374] Fix | Delete
PyBufferProcs *tp_as_buffer;
[375] Fix | Delete
[376] Fix | Delete
/* Flags to define presence of optional/expanded features */
[377] Fix | Delete
unsigned long tp_flags;
[378] Fix | Delete
[379] Fix | Delete
const char *tp_doc; /* Documentation string */
[380] Fix | Delete
[381] Fix | Delete
/* Assigned meaning in release 2.0 */
[382] Fix | Delete
/* call function for all accessible objects */
[383] Fix | Delete
traverseproc tp_traverse;
[384] Fix | Delete
[385] Fix | Delete
/* delete references to contained objects */
[386] Fix | Delete
inquiry tp_clear;
[387] Fix | Delete
[388] Fix | Delete
/* Assigned meaning in release 2.1 */
[389] Fix | Delete
/* rich comparisons */
[390] Fix | Delete
richcmpfunc tp_richcompare;
[391] Fix | Delete
[392] Fix | Delete
/* weak reference enabler */
[393] Fix | Delete
Py_ssize_t tp_weaklistoffset;
[394] Fix | Delete
[395] Fix | Delete
/* Iterators */
[396] Fix | Delete
getiterfunc tp_iter;
[397] Fix | Delete
iternextfunc tp_iternext;
[398] Fix | Delete
[399] Fix | Delete
/* Attribute descriptor and subclassing stuff */
[400] Fix | Delete
struct PyMethodDef *tp_methods;
[401] Fix | Delete
struct PyMemberDef *tp_members;
[402] Fix | Delete
struct PyGetSetDef *tp_getset;
[403] Fix | Delete
struct _typeobject *tp_base;
[404] Fix | Delete
PyObject *tp_dict;
[405] Fix | Delete
descrgetfunc tp_descr_get;
[406] Fix | Delete
descrsetfunc tp_descr_set;
[407] Fix | Delete
Py_ssize_t tp_dictoffset;
[408] Fix | Delete
initproc tp_init;
[409] Fix | Delete
allocfunc tp_alloc;
[410] Fix | Delete
newfunc tp_new;
[411] Fix | Delete
freefunc tp_free; /* Low-level free-memory routine */
[412] Fix | Delete
inquiry tp_is_gc; /* For PyObject_IS_GC */
[413] Fix | Delete
PyObject *tp_bases;
[414] Fix | Delete
PyObject *tp_mro; /* method resolution order */
[415] Fix | Delete
PyObject *tp_cache;
[416] Fix | Delete
PyObject *tp_subclasses;
[417] Fix | Delete
PyObject *tp_weaklist;
[418] Fix | Delete
destructor tp_del;
[419] Fix | Delete
[420] Fix | Delete
/* Type attribute cache version tag. Added in version 2.6 */
[421] Fix | Delete
unsigned int tp_version_tag;
[422] Fix | Delete
[423] Fix | Delete
destructor tp_finalize;
[424] Fix | Delete
[425] Fix | Delete
#ifdef COUNT_ALLOCS
[426] Fix | Delete
/* these must be last and never explicitly initialized */
[427] Fix | Delete
Py_ssize_t tp_allocs;
[428] Fix | Delete
Py_ssize_t tp_frees;
[429] Fix | Delete
Py_ssize_t tp_maxalloc;
[430] Fix | Delete
struct _typeobject *tp_prev;
[431] Fix | Delete
struct _typeobject *tp_next;
[432] Fix | Delete
#endif
[433] Fix | Delete
} PyTypeObject;
[434] Fix | Delete
#endif
[435] Fix | Delete
[436] Fix | Delete
typedef struct{
[437] Fix | Delete
int slot; /* slot id, see below */
[438] Fix | Delete
void *pfunc; /* function pointer */
[439] Fix | Delete
} PyType_Slot;
[440] Fix | Delete
[441] Fix | Delete
typedef struct{
[442] Fix | Delete
const char* name;
[443] Fix | Delete
int basicsize;
[444] Fix | Delete
int itemsize;
[445] Fix | Delete
unsigned int flags;
[446] Fix | Delete
PyType_Slot *slots; /* terminated by slot==0. */
[447] Fix | Delete
} PyType_Spec;
[448] Fix | Delete
[449] Fix | Delete
PyAPI_FUNC(PyObject*) PyType_FromSpec(PyType_Spec*);
[450] Fix | Delete
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
[451] Fix | Delete
PyAPI_FUNC(PyObject*) PyType_FromSpecWithBases(PyType_Spec*, PyObject*);
[452] Fix | Delete
#endif
[453] Fix | Delete
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000
[454] Fix | Delete
PyAPI_FUNC(void*) PyType_GetSlot(PyTypeObject*, int);
[455] Fix | Delete
#endif
[456] Fix | Delete
[457] Fix | Delete
#ifndef Py_LIMITED_API
[458] Fix | Delete
/* The *real* layout of a type object when allocated on the heap */
[459] Fix | Delete
typedef struct _heaptypeobject {
[460] Fix | Delete
/* Note: there's a dependency on the order of these members
[461] Fix | Delete
in slotptr() in typeobject.c . */
[462] Fix | Delete
PyTypeObject ht_type;
[463] Fix | Delete
PyAsyncMethods as_async;
[464] Fix | Delete
PyNumberMethods as_number;
[465] Fix | Delete
PyMappingMethods as_mapping;
[466] Fix | Delete
PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
[467] Fix | Delete
so that the mapping wins when both
[468] Fix | Delete
the mapping and the sequence define
[469] Fix | Delete
a given operator (e.g. __getitem__).
[470] Fix | Delete
see add_operators() in typeobject.c . */
[471] Fix | Delete
PyBufferProcs as_buffer;
[472] Fix | Delete
PyObject *ht_name, *ht_slots, *ht_qualname;
[473] Fix | Delete
struct _dictkeysobject *ht_cached_keys;
[474] Fix | Delete
/* here are optional user slots, followed by the members. */
[475] Fix | Delete
} PyHeapTypeObject;
[476] Fix | Delete
[477] Fix | Delete
/* access macro to the members which are floating "behind" the object */
[478] Fix | Delete
#define PyHeapType_GET_MEMBERS(etype) \
[479] Fix | Delete
((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize))
[480] Fix | Delete
#endif
[481] Fix | Delete
[482] Fix | Delete
/* Generic type check */
[483] Fix | Delete
PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
[484] Fix | Delete
#define PyObject_TypeCheck(ob, tp) \
[485] Fix | Delete
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
[486] Fix | Delete
[487] Fix | Delete
PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
[488] Fix | Delete
PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
[489] Fix | Delete
PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */
[490] Fix | Delete
[491] Fix | Delete
PyAPI_FUNC(unsigned long) PyType_GetFlags(PyTypeObject*);
[492] Fix | Delete
[493] Fix | Delete
#define PyType_Check(op) \
[494] Fix | Delete
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
[495] Fix | Delete
#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type)
[496] Fix | Delete
[497] Fix | Delete
PyAPI_FUNC(int) PyType_Ready(PyTypeObject *);
[498] Fix | Delete
PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t);
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function