힙에 객체 할당하기
******************

PyObject *_PyObject_New(PyTypeObject *type)
    *Return value: New reference.*

PyVarObject *_PyObject_NewVar(PyTypeObject *type, Py_ssize_t size)
    *Return value: New reference.*

PyObject *PyObject_Init(PyObject *op, PyTypeObject *type)
    *Return value: Borrowed reference.** Part of the Stable ABI.*

   Initialize a newly allocated object *op* with its type and initial
   reference.  Returns the initialized object.  If *type* indicates
   that the object participates in the cyclic garbage detector, it is
   added to the detector's set of observed objects. Other fields of
   the object are not affected.

PyVarObject *PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)
    *Return value: Borrowed reference.** Part of the Stable ABI.*

   이것은 "PyObject_Init()"가 수행하는 모든 작업을 수행하고, 가변 크기
   객체의 길이 정보도 초기화합니다.

TYPE *PyObject_New(TYPE, PyTypeObject *type)
    *Return value: New reference.*

   Allocate a new Python object using the C structure type *TYPE* and
   the Python type object *type*.  Fields not defined by the Python
   object header are not initialized. The caller will own the only
   reference to the object (i.e. its reference count will be one). The
   size of the memory allocation is determined from the "tp_basicsize"
   field of the type object.

TYPE *PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
    *Return value: New reference.*

   C 구조체 형 *TYPE*과 파이썬 타입 형 *type*을 사용하여 새로운 파이썬
   객체를 할당합니다. 파이썬 객체 헤더로 정의되지 않은 필드는 초기화되
   지 않습니다. 할당된 메모리는 *TYPE* 구조체에 더해 *type*의
   "tp_itemsize" 필드에 의해 주어진 크기의 *size* 필드를 허용합니다.
   이는 튜플과 같은 객체를 구현할 때 유용합니다. 튜플은 만들 때 크기를
   결정할 수 있습니다. 같은 할당에 필드 배열을 포함 시키면, 할당 횟수
   가 줄어들어, 메모리 관리 효율성이 향상됩니다.

void PyObject_Del(void *op)

   "PyObject_New()" 나 "PyObject_NewVar()"를 사용한 객체에 할당된 메모
   리를 해제합니다. 이것은 일반적으로 객체의 형에 지정된 "tp_dealloc"
   처리기에서 호출됩니다. 메모리가 더는 유효한 파이썬 객체가 아니므로,
   이 호출 후에는 객체의 필드에 액세스해서는 안 됩니다.

PyObject _Py_NoneStruct

   파이썬에서 "None"으로 노출되는 객체. 이 객체에 대한 포인터로 평가되
   는 "Py_None" 매크로를 사용해서 액세스해야 합니다.

더 보기:

  "PyModule_Create()"
     확장 모듈을 할당하고 만듭니다.
