Changeset 391 for python/trunk/Doc/c-api/allocation.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/c-api/allocation.rst
r2 r391 7 7 8 8 9 .. c function:: PyObject* _PyObject_New(PyTypeObject *type)9 .. c:function:: PyObject* _PyObject_New(PyTypeObject *type) 10 10 11 11 12 .. c function:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size)12 .. c:function:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size) 13 13 14 14 .. versionchanged:: 2.5 15 This function used an :c type:`int` type for *size*. This might require15 This function used an :c:type:`int` type for *size*. This might require 16 16 changes in your code for properly supporting 64-bit systems. 17 17 18 18 19 .. c function:: void _PyObject_Del(PyObject *op)19 .. c:function:: void _PyObject_Del(PyObject *op) 20 20 21 21 22 .. c function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)22 .. c:function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type) 23 23 24 24 Initialize a newly-allocated object *op* with its type and initial … … 29 29 30 30 31 .. c function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)31 .. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size) 32 32 33 This does everything :c func:`PyObject_Init` does, and also initializes the33 This does everything :c:func:`PyObject_Init` does, and also initializes the 34 34 length information for a variable-size object. 35 35 36 36 .. versionchanged:: 2.5 37 This function used an :c type:`int` type for *size*. This might require37 This function used an :c:type:`int` type for *size*. This might require 38 38 changes in your code for properly supporting 64-bit systems. 39 39 40 40 41 .. c function:: TYPE* PyObject_New(TYPE, PyTypeObject *type)41 .. c:function:: TYPE* PyObject_New(TYPE, PyTypeObject *type) 42 42 43 43 Allocate a new Python object using the C structure type *TYPE* and the 44 44 Python type object *type*. Fields not defined by the Python object header 45 45 are not initialized; the object's reference count will be one. The size of 46 the memory allocation is determined from the : attr:`tp_basicsize` field of46 the memory allocation is determined from the :c:member:`~PyTypeObject.tp_basicsize` field of 47 47 the type object. 48 48 49 49 50 .. c function:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)50 .. c:function:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size) 51 51 52 52 Allocate a new Python object using the C structure type *TYPE* and the 53 53 Python type object *type*. Fields not defined by the Python object header 54 54 are not initialized. The allocated memory allows for the *TYPE* structure 55 plus *size* fields of the size given by the : attr:`tp_itemsize` field of55 plus *size* fields of the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of 56 56 *type*. This is useful for implementing objects like tuples, which are 57 57 able to determine their size at construction time. Embedding the array of … … 60 60 61 61 .. versionchanged:: 2.5 62 This function used an :c type:`int` type for *size*. This might require62 This function used an :c:type:`int` type for *size*. This might require 63 63 changes in your code for properly supporting 64-bit systems. 64 64 65 65 66 .. c function:: void PyObject_Del(PyObject *op)66 .. c:function:: void PyObject_Del(PyObject *op) 67 67 68 Releases memory allocated to an object using :c func:`PyObject_New` or69 :c func:`PyObject_NewVar`. This is normally called from the70 : attr:`tp_dealloc` handler specified in the object's type. The fields of68 Releases memory allocated to an object using :c:func:`PyObject_New` or 69 :c:func:`PyObject_NewVar`. This is normally called from the 70 :c:member:`~PyTypeObject.tp_dealloc` handler specified in the object's type. The fields of 71 71 the object should not be accessed after this call as the memory is no 72 72 longer a valid Python object. 73 73 74 74 75 .. c function:: PyObject* Py_InitModule(char *name, PyMethodDef *methods)75 .. c:function:: PyObject* Py_InitModule(char *name, PyMethodDef *methods) 76 76 77 77 Create a new module object based on a name and table of functions, … … 83 83 84 84 85 .. c function:: PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc)85 .. c:function:: PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc) 86 86 87 87 Create a new module object based on a name and table of functions, … … 94 94 95 95 96 .. c function:: PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver)96 .. c:function:: PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver) 97 97 98 98 Create a new module object based on a name and table of functions, … … 108 108 109 109 Most uses of this function should probably be using the 110 :c func:`Py_InitModule3` instead; only use this if you are sure you need110 :c:func:`Py_InitModule3` instead; only use this if you are sure you need 111 111 it. 112 112 … … 116 116 117 117 118 .. c var:: PyObject _Py_NoneStruct118 .. c:var:: PyObject _Py_NoneStruct 119 119 120 120 Object which is visible in Python as ``None``. This should only be
Note:
See TracChangeset
for help on using the changeset viewer.