$98 GRAYBYTE WORDPRESS FILE MANAGER $53

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.216.174
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/include/python3.8/

HOME
Current File : /usr/include/python3.8//objimpl.h
/* The PyObject_ memory family:  high-level object memory interfaces.
   See pymem.h for the low-level PyMem_ family.
*/

#ifndef Py_OBJIMPL_H
#define Py_OBJIMPL_H

#include "pymem.h"

#ifdef __cplusplus
extern "C" {
#endif

/* BEWARE:

   Each interface exports both functions and macros.  Extension modules should
   use the functions, to ensure binary compatibility across Python versions.
   Because the Python implementation is free to change internal details, and
   the macros may (or may not) expose details for speed, if you do use the
   macros you must recompile your extensions with each Python release.

   Never mix calls to PyObject_ memory functions with calls to the platform
   malloc/realloc/ calloc/free, or with calls to PyMem_.
*/

/*
Functions and macros for modules that implement new object types.

 - PyObject_New(type, typeobj) allocates memory for a new object of the given
   type, and initializes part of it.  'type' must be the C structure type used
   to represent the object, and 'typeobj' the address of the corresponding
   type object.  Reference count and type pointer are filled in; the rest of
   the bytes of the object are *undefined*!  The resulting expression type is
   'type *'.  The size of the object is determined by the tp_basicsize field
   of the type object.

 - PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size
   object with room for n items.  In addition to the refcount and type pointer
   fields, this also fills in the ob_size field.

 - PyObject_Del(op) releases the memory allocated for an object.  It does not
   run a destructor -- it only frees the memory.  PyObject_Free is identical.

 - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't
   allocate memory.  Instead of a 'type' parameter, they take a pointer to a
   new object (allocated by an arbitrary allocator), and initialize its object
   header fields.

Note that objects created with PyObject_{New, NewVar} are allocated using the
specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is
enabled.  In addition, a special debugging allocator is used if PYMALLOC_DEBUG
is also #defined.

In case a specific form of memory management is needed (for example, if you
must use the platform malloc heap(s), or shared memory, or C++ local storage or
operator new), you must first allocate the object with your custom allocator,
then pass its pointer to PyObject_{Init, InitVar} for filling in its Python-
specific fields:  reference count, type pointer, possibly others.  You should
be aware that Python has no control over these objects because they don't
cooperate with the Python memory manager.  Such objects may not be eligible
for automatic garbage collection and you have to make sure that they are
released accordingly whenever their destructor gets called (cf. the specific
form of memory management you're using).

Unless you have specific memory management requirements, use
PyObject_{New, NewVar, Del}.
*/

/*
 * Raw object memory interface
 * ===========================
 */

/* Functions to call the same malloc/realloc/free as used by Python's
   object allocator.  If WITH_PYMALLOC is enabled, these may differ from
   the platform malloc/realloc/free.  The Python object allocator is
   designed for fast, cache-conscious allocation of many "small" objects,
   and with low hidden memory overhead.

   PyObject_Malloc(0) returns a unique non-NULL pointer if possible.

   PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n).
   PyObject_Realloc(p != NULL, 0) does not return  NULL, or free the memory
   at p.

   Returned pointers must be checked for NULL explicitly; no action is
   performed on failure other than to return NULL (no warning it printed, no
   exception is set, etc).

   For allocating objects, use PyObject_{New, NewVar} instead whenever
   possible.  The PyObject_{Malloc, Realloc, Free} family is exposed
   so that you can exploit Python's small-block allocator for non-object
   uses.  If you must use these routines to allocate object memory, make sure
   the object gets initialized via PyObject_{Init, InitVar} after obtaining
   the raw memory.
*/
PyAPI_FUNC(void *) PyObject_Malloc(size_t size);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize);
#endif
PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size);
PyAPI_FUNC(void) PyObject_Free(void *ptr);


/* Macros */
#define PyObject_MALLOC         PyObject_Malloc
#define PyObject_REALLOC        PyObject_Realloc
#define PyObject_FREE           PyObject_Free
#define PyObject_Del            PyObject_Free
#define PyObject_DEL            PyObject_Free


/*
 * Generic object allocator interface
 * ==================================
 */

/* Functions */
PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *,
                                                 PyTypeObject *, Py_ssize_t);
PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *);
PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);

#define PyObject_New(type, typeobj) \
                ( (type *) _PyObject_New(typeobj) )
#define PyObject_NewVar(type, typeobj, n) \
                ( (type *) _PyObject_NewVar((typeobj), (n)) )

/* Inline functions trading binary compatibility for speed:
   PyObject_INIT() is the fast version of PyObject_Init(), and
   PyObject_INIT_VAR() is the fast version of PyObject_InitVar.
   See also pymem.h.

   These inline functions expect non-NULL object pointers. */
static inline PyObject*
_PyObject_INIT(PyObject *op, PyTypeObject *typeobj)
{
    assert(op != NULL);
    Py_TYPE(op) = typeobj;
    if (PyType_GetFlags(typeobj) & Py_TPFLAGS_HEAPTYPE) {
        Py_INCREF(typeobj);
    }
    _Py_NewReference(op);
    return op;
}

#define PyObject_INIT(op, typeobj) \
    _PyObject_INIT(_PyObject_CAST(op), (typeobj))

static inline PyVarObject*
_PyObject_INIT_VAR(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size)
{
    assert(op != NULL);
    Py_SIZE(op) = size;
    PyObject_INIT((PyObject *)op, typeobj);
    return op;
}

#define PyObject_INIT_VAR(op, typeobj, size) \
    _PyObject_INIT_VAR(_PyVarObject_CAST(op), (typeobj), (size))

#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )

/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a
   vrbl-size object with nitems items, exclusive of gc overhead (if any).  The
   value is rounded up to the closest multiple of sizeof(void *), in order to
   ensure that pointer fields at the end of the object are correctly aligned
   for the platform (this is of special importance for subclasses of, e.g.,
   str or int, so that pointers can be stored after the embedded data).

   Note that there's no memory wastage in doing this, as malloc has to
   return (at worst) pointer-aligned memory anyway.
*/
#if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0
#   error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2"
#endif

#define _PyObject_VAR_SIZE(typeobj, nitems)     \
    _Py_SIZE_ROUND_UP((typeobj)->tp_basicsize + \
        (nitems)*(typeobj)->tp_itemsize,        \
        SIZEOF_VOID_P)

#define PyObject_NEW(type, typeobj) \
( (type *) PyObject_Init( \
    (PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) )

#define PyObject_NEW_VAR(type, typeobj, n) \
( (type *) PyObject_InitVar( \
      (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),(n)) ),\
      (typeobj), (n)) )

/* This example code implements an object constructor with a custom
   allocator, where PyObject_New is inlined, and shows the important
   distinction between two steps (at least):
       1) the actual allocation of the object storage;
       2) the initialization of the Python specific fields
      in this storage with PyObject_{Init, InitVar}.

   PyObject *
   YourObject_New(...)
   {
       PyObject *op;

       op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct));
       if (op == NULL)
       return PyErr_NoMemory();

       PyObject_Init(op, &YourTypeStruct);

       op->ob_field = value;
       ...
       return op;
   }

   Note that in C++, the use of the new operator usually implies that
   the 1st step is performed automatically for you, so in a C++ class
   constructor you would start directly with PyObject_Init/InitVar
*/



/*
 * Garbage Collection Support
 * ==========================
 */

/* C equivalent of gc.collect() which ignores the state of gc.enabled. */
PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void);

/* Test if a type has a GC head */
#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)

PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
#define PyObject_GC_Resize(type, op, n) \
                ( (type *) _PyObject_GC_Resize(_PyVarObject_CAST(op), (n)) )



PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *);
PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t);

/* Tell the GC to track this object.
 *
 * See also private _PyObject_GC_TRACK() macro. */
PyAPI_FUNC(void) PyObject_GC_Track(void *);

/* Tell the GC to stop tracking this object.
 *
 * See also private _PyObject_GC_UNTRACK() macro. */
PyAPI_FUNC(void) PyObject_GC_UnTrack(void *);

PyAPI_FUNC(void) PyObject_GC_Del(void *);

#define PyObject_GC_New(type, typeobj) \
                ( (type *) _PyObject_GC_New(typeobj) )
#define PyObject_GC_NewVar(type, typeobj, n) \
                ( (type *) _PyObject_GC_NewVar((typeobj), (n)) )


/* Utility macro to help write tp_traverse functions.
 * To use this macro, the tp_traverse function must name its arguments
 * "visit" and "arg".  This is intended to keep tp_traverse functions
 * looking as much alike as possible.
 */
#define Py_VISIT(op)                                                    \
    do {                                                                \
        if (op) {                                                       \
            int vret = visit(_PyObject_CAST(op), arg);                  \
            if (vret)                                                   \
                return vret;                                            \
        }                                                               \
    } while (0)

#ifndef Py_LIMITED_API
#  define Py_CPYTHON_OBJIMPL_H
#  include  "cpython/objimpl.h"
#  undef Py_CPYTHON_OBJIMPL_H
#endif

#ifdef __cplusplus
}
#endif
#endif /* !Py_OBJIMPL_H */


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Mar 2026 8.34 AM
root / root
0755
cpython
--
21 Mar 2024 10.19 AM
root / root
0755
internal
--
21 Mar 2024 10.19 AM
root / root
0755
Python-ast.h
25.87 KB
6 Jun 2023 1.40 PM
root / root
0644
Python.h
3.53 KB
6 Jun 2023 1.32 PM
root / root
0644
_hashopenssl.h
1.333 KB
17 Oct 2023 6.02 PM
root / root
0644
abstract.h
29.576 KB
6 Jun 2023 1.32 PM
root / root
0644
asdl.h
1.2 KB
6 Jun 2023 1.32 PM
root / root
0644
ast.h
0.926 KB
6 Jun 2023 1.32 PM
root / root
0644
bitset.h
0.457 KB
6 Jun 2023 1.32 PM
root / root
0644
bltinmodule.h
0.258 KB
6 Jun 2023 1.32 PM
root / root
0644
boolobject.h
0.865 KB
6 Jun 2023 1.32 PM
root / root
0644
bytearrayobject.h
2.064 KB
6 Jun 2023 1.32 PM
root / root
0644
bytes_methods.h
3.224 KB
6 Jun 2023 1.32 PM
root / root
0644
bytesobject.h
8.294 KB
6 Jun 2023 1.32 PM
root / root
0644
cellobject.h
0.696 KB
6 Jun 2023 1.32 PM
root / root
0644
ceval.h
8.17 KB
6 Jun 2023 1.32 PM
root / root
0644
classobject.h
1.67 KB
6 Jun 2023 1.32 PM
root / root
0644
code.h
7.01 KB
6 Jun 2023 1.32 PM
root / root
0644
codecs.h
6.634 KB
6 Jun 2023 1.32 PM
root / root
0644
compile.h
3.498 KB
6 Jun 2023 1.32 PM
root / root
0644
complexobject.h
1.765 KB
6 Jun 2023 1.32 PM
root / root
0644
context.h
1.967 KB
6 Jun 2023 1.32 PM
root / root
0644
datetime.h
9.043 KB
6 Jun 2023 1.32 PM
root / root
0644
descrobject.h
2.948 KB
6 Jun 2023 1.32 PM
root / root
0644
dictobject.h
3.629 KB
6 Jun 2023 1.32 PM
root / root
0644
dtoa.h
0.447 KB
6 Jun 2023 1.32 PM
root / root
0644
dynamic_annotations.h
21.942 KB
6 Jun 2023 1.32 PM
root / root
0644
enumobject.h
0.247 KB
6 Jun 2023 1.32 PM
root / root
0644
errcode.h
1.655 KB
6 Jun 2023 1.32 PM
root / root
0644
eval.h
1.181 KB
6 Jun 2023 1.32 PM
root / root
0644
fileobject.h
1.534 KB
6 Jun 2023 1.32 PM
root / root
0644
fileutils.h
4.25 KB
6 Jun 2023 1.32 PM
root / root
0644
floatobject.h
4.682 KB
6 Jun 2023 1.32 PM
root / root
0644
frameobject.h
3.239 KB
6 Jun 2023 1.32 PM
root / root
0644
funcobject.h
4.102 KB
6 Jun 2023 1.32 PM
root / root
0644
genobject.h
3.633 KB
6 Jun 2023 1.32 PM
root / root
0644
graminit.h
2.068 KB
6 Jun 2023 1.32 PM
root / root
0644
grammar.h
1.778 KB
6 Jun 2023 1.32 PM
root / root
0644
import.h
4.811 KB
6 Jun 2023 1.32 PM
root / root
0644
interpreteridobject.h
0.326 KB
6 Jun 2023 1.32 PM
root / root
0644
intrcheck.h
0.841 KB
6 Jun 2023 1.32 PM
root / root
0644
iterobject.h
0.554 KB
6 Jun 2023 1.32 PM
root / root
0644
listobject.h
2.858 KB
6 Jun 2023 1.32 PM
root / root
0644
longintrepr.h
3.71 KB
6 Jun 2023 1.32 PM
root / root
0644
longobject.h
9.297 KB
6 Jun 2023 1.32 PM
root / root
0644
marshal.h
0.784 KB
6 Jun 2023 1.32 PM
root / root
0644
memoryobject.h
2.7 KB
6 Jun 2023 1.32 PM
root / root
0644
methodobject.h
4.303 KB
6 Jun 2023 1.32 PM
root / root
0644
modsupport.h
9.366 KB
6 Jun 2023 1.32 PM
root / root
0644
moduleobject.h
2.307 KB
6 Jun 2023 1.32 PM
root / root
0644
namespaceobject.h
0.341 KB
6 Jun 2023 1.32 PM
root / root
0644
node.h
1.297 KB
6 Jun 2023 1.32 PM
root / root
0644
object.h
28.905 KB
6 Jun 2023 1.32 PM
root / root
0644
objimpl.h
10.29 KB
6 Jun 2023 1.32 PM
root / root
0644
odictobject.h
1.27 KB
6 Jun 2023 1.32 PM
root / root
0644
opcode.h
5.043 KB
6 Jun 2023 1.32 PM
root / root
0644
osdefs.h
0.72 KB
6 Jun 2023 1.32 PM
root / root
0644
osmodule.h
0.284 KB
6 Jun 2023 1.32 PM
root / root
0644
parsetok.h
2.889 KB
6 Jun 2023 1.32 PM
root / root
0644
patchlevel.h
1.269 KB
6 Jun 2023 1.32 PM
root / root
0644
picklebufobject.h
0.827 KB
6 Jun 2023 1.32 PM
root / root
0644
py_curses.h
2.419 KB
6 Jun 2023 1.32 PM
root / root
0644
pyarena.h
2.68 KB
6 Jun 2023 1.32 PM
root / root
0644
pycapsule.h
1.686 KB
6 Jun 2023 1.32 PM
root / root
0644
pyconfig-64.h
46.41 KB
17 Oct 2023 6.04 PM
root / root
0644
pyconfig.h
0.158 KB
17 Oct 2023 6.12 PM
root / root
0644
pyctype.h
1.354 KB
6 Jun 2023 1.32 PM
root / root
0644
pydebug.h
1.186 KB
6 Jun 2023 1.32 PM
root / root
0644
pydtrace.h
2.356 KB
6 Jun 2023 1.32 PM
root / root
0644
pyerrors.h
12.486 KB
6 Jun 2023 1.32 PM
root / root
0644
pyexpat.h
2.393 KB
6 Jun 2023 1.32 PM
root / root
0644
pyfpe.h
0.333 KB
6 Jun 2023 1.32 PM
root / root
0644
pyhash.h
4.043 KB
6 Jun 2023 1.32 PM
root / root
0644
pylifecycle.h
2.032 KB
6 Jun 2023 1.32 PM
root / root
0644
pymacconfig.h
2.919 KB
6 Jun 2023 1.32 PM
root / root
0644
pymacro.h
3.689 KB
6 Jun 2023 1.32 PM
root / root
0644
pymath.h
8.117 KB
6 Jun 2023 1.32 PM
root / root
0644
pymem.h
5.279 KB
6 Jun 2023 1.32 PM
root / root
0644
pyport.h
29.513 KB
6 Jun 2023 1.32 PM
root / root
0644
pystate.h
4.576 KB
6 Jun 2023 1.32 PM
root / root
0644
pystrcmp.h
0.426 KB
6 Jun 2023 1.32 PM
root / root
0644
pystrhex.h
0.829 KB
6 Jun 2023 1.32 PM
root / root
0644
pystrtod.h
1.448 KB
6 Jun 2023 1.32 PM
root / root
0644
pythonrun.h
7.466 KB
6 Jun 2023 1.32 PM
root / root
0644
pythread.h
5.527 KB
6 Jun 2023 1.32 PM
root / root
0644
pytime.h
8.717 KB
6 Jun 2023 1.32 PM
root / root
0644
rangeobject.h
0.614 KB
6 Jun 2023 1.32 PM
root / root
0644
setobject.h
3.283 KB
6 Jun 2023 1.32 PM
root / root
0644
sliceobject.h
2.458 KB
6 Jun 2023 1.32 PM
root / root
0644
structmember.h
1.982 KB
6 Jun 2023 1.32 PM
root / root
0644
structseq.h
1.345 KB
6 Jun 2023 1.32 PM
root / root
0644
symtable.h
5.184 KB
6 Jun 2023 1.32 PM
root / root
0644
sysmodule.h
1.213 KB
6 Jun 2023 1.32 PM
root / root
0644
token.h
2.372 KB
6 Jun 2023 1.32 PM
root / root
0644
traceback.h
0.587 KB
6 Jun 2023 1.32 PM
root / root
0644
tracemalloc.h
1.088 KB
6 Jun 2023 1.32 PM
root / root
0644
tupleobject.h
1.622 KB
6 Jun 2023 1.32 PM
root / root
0644
typeslots.h
2.2 KB
6 Jun 2023 1.32 PM
root / root
0644
ucnhash.h
1.031 KB
6 Jun 2023 1.32 PM
root / root
0644
unicodeobject.h
34.895 KB
6 Jun 2023 1.32 PM
root / root
0644
warnings.h
1.734 KB
6 Jun 2023 1.32 PM
root / root
0644
weakrefobject.h
2.799 KB
6 Jun 2023 1.32 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF