Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
master
master
Branches (1)
master
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
master
python3.7.4
/
Doc
/
c-api
/
allocation.rst
python3.7.4
/
Doc
/
c-api
/
allocation.rst
allocation.rst 2.59 KB
Copy Edit Raw Blame History
zhangweibo authored 2021年11月17日 13:49 +08:00 . git init
.. highlightlang:: c

Allocating Objects on the Heap

.. c:function:: PyObject* _PyObject_New(PyTypeObject *type)


.. c:function:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size)


.. c:function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)

 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.


.. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)

 This does everything :c:func:`PyObject_Init` does, and also initializes the
 length information for a variable-size object.


.. c:function:: TYPE* PyObject_New(TYPE, PyTypeObject *type)

 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 object's reference count will be one. The size of
 the memory allocation is determined from the :c:member:`~PyTypeObject.tp_basicsize` field of
 the type object.


.. c:function:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)

 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 allocated memory allows for the *TYPE* structure
 plus *size* fields of the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of
 *type*. This is useful for implementing objects like tuples, which are
 able to determine their size at construction time. Embedding the array of
 fields into the same allocation decreases the number of allocations,
 improving the memory management efficiency.


.. c:function:: void PyObject_Del(PyObject *op)

 Releases memory allocated to an object using :c:func:`PyObject_New` or
 :c:func:`PyObject_NewVar`. This is normally called from the
 :c:member:`~PyTypeObject.tp_dealloc` handler specified in the object's type. The fields of
 the object should not be accessed after this call as the memory is no
 longer a valid Python object.


.. c:var:: PyObject _Py_NoneStruct

 Object which is visible in Python as ``None``. This should only be accessed
 using the :c:macro:`Py_None` macro, which evaluates to a pointer to this
 object.


.. seealso::

 :c:func:`PyModule_Create`
 To allocate and create extension modules.

Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

No description
Cancel

Releases

No release

Contributors

All

Language(Optional)

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/python_sourcecode/python3.7.4.git
git@gitee.com:python_sourcecode/python3.7.4.git
python_sourcecode
python3.7.4
python3.7.4
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /