Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/python3....
File: objimpl.h
/* The PyObject_ memory family: high-level object memory interfaces.
[0] Fix | Delete
See pymem.h for the low-level PyMem_ family.
[1] Fix | Delete
*/
[2] Fix | Delete
[3] Fix | Delete
#ifndef Py_OBJIMPL_H
[4] Fix | Delete
#define Py_OBJIMPL_H
[5] Fix | Delete
[6] Fix | Delete
#include "pymem.h"
[7] Fix | Delete
[8] Fix | Delete
#ifdef __cplusplus
[9] Fix | Delete
extern "C" {
[10] Fix | Delete
#endif
[11] Fix | Delete
[12] Fix | Delete
/* BEWARE:
[13] Fix | Delete
[14] Fix | Delete
Each interface exports both functions and macros. Extension modules should
[15] Fix | Delete
use the functions, to ensure binary compatibility across Python versions.
[16] Fix | Delete
Because the Python implementation is free to change internal details, and
[17] Fix | Delete
the macros may (or may not) expose details for speed, if you do use the
[18] Fix | Delete
macros you must recompile your extensions with each Python release.
[19] Fix | Delete
[20] Fix | Delete
Never mix calls to PyObject_ memory functions with calls to the platform
[21] Fix | Delete
malloc/realloc/ calloc/free, or with calls to PyMem_.
[22] Fix | Delete
*/
[23] Fix | Delete
[24] Fix | Delete
/*
[25] Fix | Delete
Functions and macros for modules that implement new object types.
[26] Fix | Delete
[27] Fix | Delete
- PyObject_New(type, typeobj) allocates memory for a new object of the given
[28] Fix | Delete
type, and initializes part of it. 'type' must be the C structure type used
[29] Fix | Delete
to represent the object, and 'typeobj' the address of the corresponding
[30] Fix | Delete
type object. Reference count and type pointer are filled in; the rest of
[31] Fix | Delete
the bytes of the object are *undefined*! The resulting expression type is
[32] Fix | Delete
'type *'. The size of the object is determined by the tp_basicsize field
[33] Fix | Delete
of the type object.
[34] Fix | Delete
[35] Fix | Delete
- PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size
[36] Fix | Delete
object with room for n items. In addition to the refcount and type pointer
[37] Fix | Delete
fields, this also fills in the ob_size field.
[38] Fix | Delete
[39] Fix | Delete
- PyObject_Del(op) releases the memory allocated for an object. It does not
[40] Fix | Delete
run a destructor -- it only frees the memory. PyObject_Free is identical.
[41] Fix | Delete
[42] Fix | Delete
- PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't
[43] Fix | Delete
allocate memory. Instead of a 'type' parameter, they take a pointer to a
[44] Fix | Delete
new object (allocated by an arbitrary allocator), and initialize its object
[45] Fix | Delete
header fields.
[46] Fix | Delete
[47] Fix | Delete
Note that objects created with PyObject_{New, NewVar} are allocated using the
[48] Fix | Delete
specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is
[49] Fix | Delete
enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG
[50] Fix | Delete
is also #defined.
[51] Fix | Delete
[52] Fix | Delete
In case a specific form of memory management is needed (for example, if you
[53] Fix | Delete
must use the platform malloc heap(s), or shared memory, or C++ local storage or
[54] Fix | Delete
operator new), you must first allocate the object with your custom allocator,
[55] Fix | Delete
then pass its pointer to PyObject_{Init, InitVar} for filling in its Python-
[56] Fix | Delete
specific fields: reference count, type pointer, possibly others. You should
[57] Fix | Delete
be aware that Python has no control over these objects because they don't
[58] Fix | Delete
cooperate with the Python memory manager. Such objects may not be eligible
[59] Fix | Delete
for automatic garbage collection and you have to make sure that they are
[60] Fix | Delete
released accordingly whenever their destructor gets called (cf. the specific
[61] Fix | Delete
form of memory management you're using).
[62] Fix | Delete
[63] Fix | Delete
Unless you have specific memory management requirements, use
[64] Fix | Delete
PyObject_{New, NewVar, Del}.
[65] Fix | Delete
*/
[66] Fix | Delete
[67] Fix | Delete
/*
[68] Fix | Delete
* Raw object memory interface
[69] Fix | Delete
* ===========================
[70] Fix | Delete
*/
[71] Fix | Delete
[72] Fix | Delete
/* Functions to call the same malloc/realloc/free as used by Python's
[73] Fix | Delete
object allocator. If WITH_PYMALLOC is enabled, these may differ from
[74] Fix | Delete
the platform malloc/realloc/free. The Python object allocator is
[75] Fix | Delete
designed for fast, cache-conscious allocation of many "small" objects,
[76] Fix | Delete
and with low hidden memory overhead.
[77] Fix | Delete
[78] Fix | Delete
PyObject_Malloc(0) returns a unique non-NULL pointer if possible.
[79] Fix | Delete
[80] Fix | Delete
PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n).
[81] Fix | Delete
PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory
[82] Fix | Delete
at p.
[83] Fix | Delete
[84] Fix | Delete
Returned pointers must be checked for NULL explicitly; no action is
[85] Fix | Delete
performed on failure other than to return NULL (no warning it printed, no
[86] Fix | Delete
exception is set, etc).
[87] Fix | Delete
[88] Fix | Delete
For allocating objects, use PyObject_{New, NewVar} instead whenever
[89] Fix | Delete
possible. The PyObject_{Malloc, Realloc, Free} family is exposed
[90] Fix | Delete
so that you can exploit Python's small-block allocator for non-object
[91] Fix | Delete
uses. If you must use these routines to allocate object memory, make sure
[92] Fix | Delete
the object gets initialized via PyObject_{Init, InitVar} after obtaining
[93] Fix | Delete
the raw memory.
[94] Fix | Delete
*/
[95] Fix | Delete
PyAPI_FUNC(void *) PyObject_Malloc(size_t size);
[96] Fix | Delete
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
[97] Fix | Delete
PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize);
[98] Fix | Delete
#endif
[99] Fix | Delete
PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size);
[100] Fix | Delete
PyAPI_FUNC(void) PyObject_Free(void *ptr);
[101] Fix | Delete
[102] Fix | Delete
#ifndef Py_LIMITED_API
[103] Fix | Delete
/* This function returns the number of allocated memory blocks, regardless of size */
[104] Fix | Delete
PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
[105] Fix | Delete
#endif /* !Py_LIMITED_API */
[106] Fix | Delete
[107] Fix | Delete
/* Macros */
[108] Fix | Delete
#ifdef WITH_PYMALLOC
[109] Fix | Delete
#ifndef Py_LIMITED_API
[110] Fix | Delete
PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out);
[111] Fix | Delete
#endif /* #ifndef Py_LIMITED_API */
[112] Fix | Delete
#endif
[113] Fix | Delete
[114] Fix | Delete
/* Macros */
[115] Fix | Delete
#define PyObject_MALLOC PyObject_Malloc
[116] Fix | Delete
#define PyObject_REALLOC PyObject_Realloc
[117] Fix | Delete
#define PyObject_FREE PyObject_Free
[118] Fix | Delete
#define PyObject_Del PyObject_Free
[119] Fix | Delete
#define PyObject_DEL PyObject_Free
[120] Fix | Delete
[121] Fix | Delete
[122] Fix | Delete
/*
[123] Fix | Delete
* Generic object allocator interface
[124] Fix | Delete
* ==================================
[125] Fix | Delete
*/
[126] Fix | Delete
[127] Fix | Delete
/* Functions */
[128] Fix | Delete
PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
[129] Fix | Delete
PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *,
[130] Fix | Delete
PyTypeObject *, Py_ssize_t);
[131] Fix | Delete
PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *);
[132] Fix | Delete
PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);
[133] Fix | Delete
[134] Fix | Delete
#define PyObject_New(type, typeobj) \
[135] Fix | Delete
( (type *) _PyObject_New(typeobj) )
[136] Fix | Delete
#define PyObject_NewVar(type, typeobj, n) \
[137] Fix | Delete
( (type *) _PyObject_NewVar((typeobj), (n)) )
[138] Fix | Delete
[139] Fix | Delete
/* Macros trading binary compatibility for speed. See also pymem.h.
[140] Fix | Delete
Note that these macros expect non-NULL object pointers.*/
[141] Fix | Delete
#define PyObject_INIT(op, typeobj) \
[142] Fix | Delete
( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
[143] Fix | Delete
#define PyObject_INIT_VAR(op, typeobj, size) \
[144] Fix | Delete
( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) )
[145] Fix | Delete
[146] Fix | Delete
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
[147] Fix | Delete
[148] Fix | Delete
/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a
[149] Fix | Delete
vrbl-size object with nitems items, exclusive of gc overhead (if any). The
[150] Fix | Delete
value is rounded up to the closest multiple of sizeof(void *), in order to
[151] Fix | Delete
ensure that pointer fields at the end of the object are correctly aligned
[152] Fix | Delete
for the platform (this is of special importance for subclasses of, e.g.,
[153] Fix | Delete
str or int, so that pointers can be stored after the embedded data).
[154] Fix | Delete
[155] Fix | Delete
Note that there's no memory wastage in doing this, as malloc has to
[156] Fix | Delete
return (at worst) pointer-aligned memory anyway.
[157] Fix | Delete
*/
[158] Fix | Delete
#if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0
[159] Fix | Delete
# error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2"
[160] Fix | Delete
#endif
[161] Fix | Delete
[162] Fix | Delete
#define _PyObject_VAR_SIZE(typeobj, nitems) \
[163] Fix | Delete
_Py_SIZE_ROUND_UP((typeobj)->tp_basicsize + \
[164] Fix | Delete
(nitems)*(typeobj)->tp_itemsize, \
[165] Fix | Delete
SIZEOF_VOID_P)
[166] Fix | Delete
[167] Fix | Delete
#define PyObject_NEW(type, typeobj) \
[168] Fix | Delete
( (type *) PyObject_Init( \
[169] Fix | Delete
(PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) )
[170] Fix | Delete
[171] Fix | Delete
#define PyObject_NEW_VAR(type, typeobj, n) \
[172] Fix | Delete
( (type *) PyObject_InitVar( \
[173] Fix | Delete
(PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),(n)) ),\
[174] Fix | Delete
(typeobj), (n)) )
[175] Fix | Delete
[176] Fix | Delete
/* This example code implements an object constructor with a custom
[177] Fix | Delete
allocator, where PyObject_New is inlined, and shows the important
[178] Fix | Delete
distinction between two steps (at least):
[179] Fix | Delete
1) the actual allocation of the object storage;
[180] Fix | Delete
2) the initialization of the Python specific fields
[181] Fix | Delete
in this storage with PyObject_{Init, InitVar}.
[182] Fix | Delete
[183] Fix | Delete
PyObject *
[184] Fix | Delete
YourObject_New(...)
[185] Fix | Delete
{
[186] Fix | Delete
PyObject *op;
[187] Fix | Delete
[188] Fix | Delete
op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct));
[189] Fix | Delete
if (op == NULL)
[190] Fix | Delete
return PyErr_NoMemory();
[191] Fix | Delete
[192] Fix | Delete
PyObject_Init(op, &YourTypeStruct);
[193] Fix | Delete
[194] Fix | Delete
op->ob_field = value;
[195] Fix | Delete
...
[196] Fix | Delete
return op;
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
Note that in C++, the use of the new operator usually implies that
[200] Fix | Delete
the 1st step is performed automatically for you, so in a C++ class
[201] Fix | Delete
constructor you would start directly with PyObject_Init/InitVar
[202] Fix | Delete
*/
[203] Fix | Delete
[204] Fix | Delete
#ifndef Py_LIMITED_API
[205] Fix | Delete
typedef struct {
[206] Fix | Delete
/* user context passed as the first argument to the 2 functions */
[207] Fix | Delete
void *ctx;
[208] Fix | Delete
[209] Fix | Delete
/* allocate an arena of size bytes */
[210] Fix | Delete
void* (*alloc) (void *ctx, size_t size);
[211] Fix | Delete
[212] Fix | Delete
/* free an arena */
[213] Fix | Delete
void (*free) (void *ctx, void *ptr, size_t size);
[214] Fix | Delete
} PyObjectArenaAllocator;
[215] Fix | Delete
[216] Fix | Delete
/* Get the arena allocator. */
[217] Fix | Delete
PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator);
[218] Fix | Delete
[219] Fix | Delete
/* Set the arena allocator. */
[220] Fix | Delete
PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator);
[221] Fix | Delete
#endif
[222] Fix | Delete
[223] Fix | Delete
[224] Fix | Delete
/*
[225] Fix | Delete
* Garbage Collection Support
[226] Fix | Delete
* ==========================
[227] Fix | Delete
*/
[228] Fix | Delete
[229] Fix | Delete
/* C equivalent of gc.collect() which ignores the state of gc.enabled. */
[230] Fix | Delete
PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void);
[231] Fix | Delete
[232] Fix | Delete
#ifndef Py_LIMITED_API
[233] Fix | Delete
PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void);
[234] Fix | Delete
PyAPI_FUNC(Py_ssize_t) _PyGC_CollectIfEnabled(void);
[235] Fix | Delete
#endif
[236] Fix | Delete
[237] Fix | Delete
/* Test if a type has a GC head */
[238] Fix | Delete
#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
[239] Fix | Delete
[240] Fix | Delete
/* Test if an object has a GC head */
[241] Fix | Delete
#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \
[242] Fix | Delete
(Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o)))
[243] Fix | Delete
[244] Fix | Delete
PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
[245] Fix | Delete
#define PyObject_GC_Resize(type, op, n) \
[246] Fix | Delete
( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) )
[247] Fix | Delete
[248] Fix | Delete
/* GC information is stored BEFORE the object structure. */
[249] Fix | Delete
#ifndef Py_LIMITED_API
[250] Fix | Delete
typedef union _gc_head {
[251] Fix | Delete
struct {
[252] Fix | Delete
union _gc_head *gc_next;
[253] Fix | Delete
union _gc_head *gc_prev;
[254] Fix | Delete
Py_ssize_t gc_refs;
[255] Fix | Delete
} gc;
[256] Fix | Delete
double dummy; /* force worst-case alignment */
[257] Fix | Delete
} PyGC_Head;
[258] Fix | Delete
[259] Fix | Delete
extern PyGC_Head *_PyGC_generation0;
[260] Fix | Delete
[261] Fix | Delete
#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1)
[262] Fix | Delete
[263] Fix | Delete
/* Bit 0 is set when tp_finalize is called */
[264] Fix | Delete
#define _PyGC_REFS_MASK_FINALIZED (1 << 0)
[265] Fix | Delete
/* The (N-1) most significant bits contain the gc state / refcount */
[266] Fix | Delete
#define _PyGC_REFS_SHIFT (1)
[267] Fix | Delete
#define _PyGC_REFS_MASK (((size_t) -1) << _PyGC_REFS_SHIFT)
[268] Fix | Delete
[269] Fix | Delete
#define _PyGCHead_REFS(g) ((g)->gc.gc_refs >> _PyGC_REFS_SHIFT)
[270] Fix | Delete
#define _PyGCHead_SET_REFS(g, v) do { \
[271] Fix | Delete
(g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK) \
[272] Fix | Delete
| (((size_t)(v)) << _PyGC_REFS_SHIFT); \
[273] Fix | Delete
} while (0)
[274] Fix | Delete
#define _PyGCHead_DECREF(g) ((g)->gc.gc_refs -= 1 << _PyGC_REFS_SHIFT)
[275] Fix | Delete
[276] Fix | Delete
#define _PyGCHead_FINALIZED(g) (((g)->gc.gc_refs & _PyGC_REFS_MASK_FINALIZED) != 0)
[277] Fix | Delete
#define _PyGCHead_SET_FINALIZED(g, v) do { \
[278] Fix | Delete
(g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK_FINALIZED) \
[279] Fix | Delete
| (v != 0); \
[280] Fix | Delete
} while (0)
[281] Fix | Delete
[282] Fix | Delete
#define _PyGC_FINALIZED(o) _PyGCHead_FINALIZED(_Py_AS_GC(o))
[283] Fix | Delete
#define _PyGC_SET_FINALIZED(o, v) _PyGCHead_SET_FINALIZED(_Py_AS_GC(o), v)
[284] Fix | Delete
[285] Fix | Delete
#define _PyGC_REFS(o) _PyGCHead_REFS(_Py_AS_GC(o))
[286] Fix | Delete
[287] Fix | Delete
#define _PyGC_REFS_UNTRACKED (-2)
[288] Fix | Delete
#define _PyGC_REFS_REACHABLE (-3)
[289] Fix | Delete
#define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4)
[290] Fix | Delete
[291] Fix | Delete
/* Tell the GC to track this object. NB: While the object is tracked the
[292] Fix | Delete
* collector it must be safe to call the ob_traverse method. */
[293] Fix | Delete
#define _PyObject_GC_TRACK(o) do { \
[294] Fix | Delete
PyGC_Head *g = _Py_AS_GC(o); \
[295] Fix | Delete
if (_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED) \
[296] Fix | Delete
Py_FatalError("GC object already tracked"); \
[297] Fix | Delete
_PyGCHead_SET_REFS(g, _PyGC_REFS_REACHABLE); \
[298] Fix | Delete
g->gc.gc_next = _PyGC_generation0; \
[299] Fix | Delete
g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \
[300] Fix | Delete
g->gc.gc_prev->gc.gc_next = g; \
[301] Fix | Delete
_PyGC_generation0->gc.gc_prev = g; \
[302] Fix | Delete
} while (0);
[303] Fix | Delete
[304] Fix | Delete
/* Tell the GC to stop tracking this object.
[305] Fix | Delete
* gc_next doesn't need to be set to NULL, but doing so is a good
[306] Fix | Delete
* way to provoke memory errors if calling code is confused.
[307] Fix | Delete
*/
[308] Fix | Delete
#define _PyObject_GC_UNTRACK(o) do { \
[309] Fix | Delete
PyGC_Head *g = _Py_AS_GC(o); \
[310] Fix | Delete
assert(_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED); \
[311] Fix | Delete
_PyGCHead_SET_REFS(g, _PyGC_REFS_UNTRACKED); \
[312] Fix | Delete
g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \
[313] Fix | Delete
g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \
[314] Fix | Delete
g->gc.gc_next = NULL; \
[315] Fix | Delete
} while (0);
[316] Fix | Delete
[317] Fix | Delete
/* True if the object is currently tracked by the GC. */
[318] Fix | Delete
#define _PyObject_GC_IS_TRACKED(o) \
[319] Fix | Delete
(_PyGC_REFS(o) != _PyGC_REFS_UNTRACKED)
[320] Fix | Delete
[321] Fix | Delete
/* True if the object may be tracked by the GC in the future, or already is.
[322] Fix | Delete
This can be useful to implement some optimizations. */
[323] Fix | Delete
#define _PyObject_GC_MAY_BE_TRACKED(obj) \
[324] Fix | Delete
(PyObject_IS_GC(obj) && \
[325] Fix | Delete
(!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj)))
[326] Fix | Delete
#endif /* Py_LIMITED_API */
[327] Fix | Delete
[328] Fix | Delete
#ifndef Py_LIMITED_API
[329] Fix | Delete
PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t size);
[330] Fix | Delete
PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size);
[331] Fix | Delete
#endif /* !Py_LIMITED_API */
[332] Fix | Delete
PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *);
[333] Fix | Delete
PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t);
[334] Fix | Delete
PyAPI_FUNC(void) PyObject_GC_Track(void *);
[335] Fix | Delete
PyAPI_FUNC(void) PyObject_GC_UnTrack(void *);
[336] Fix | Delete
PyAPI_FUNC(void) PyObject_GC_Del(void *);
[337] Fix | Delete
[338] Fix | Delete
#define PyObject_GC_New(type, typeobj) \
[339] Fix | Delete
( (type *) _PyObject_GC_New(typeobj) )
[340] Fix | Delete
#define PyObject_GC_NewVar(type, typeobj, n) \
[341] Fix | Delete
( (type *) _PyObject_GC_NewVar((typeobj), (n)) )
[342] Fix | Delete
[343] Fix | Delete
[344] Fix | Delete
/* Utility macro to help write tp_traverse functions.
[345] Fix | Delete
* To use this macro, the tp_traverse function must name its arguments
[346] Fix | Delete
* "visit" and "arg". This is intended to keep tp_traverse functions
[347] Fix | Delete
* looking as much alike as possible.
[348] Fix | Delete
*/
[349] Fix | Delete
#define Py_VISIT(op) \
[350] Fix | Delete
do { \
[351] Fix | Delete
if (op) { \
[352] Fix | Delete
int vret = visit((PyObject *)(op), arg); \
[353] Fix | Delete
if (vret) \
[354] Fix | Delete
return vret; \
[355] Fix | Delete
} \
[356] Fix | Delete
} while (0)
[357] Fix | Delete
[358] Fix | Delete
[359] Fix | Delete
/* Test if a type supports weak references */
[360] Fix | Delete
#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
[361] Fix | Delete
[362] Fix | Delete
#define PyObject_GET_WEAKREFS_LISTPTR(o) \
[363] Fix | Delete
((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset))
[364] Fix | Delete
[365] Fix | Delete
#ifdef __cplusplus
[366] Fix | Delete
}
[367] Fix | Delete
#endif
[368] Fix | Delete
#endif /* !Py_OBJIMPL_H */
[369] Fix | Delete
[370] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function