Teks sumber — English
Terjemahan — Bahasa Indonesia
Code Objects
Objek Kode
Code objects are a low-level detail of the CPython implementation. Each one represents a chunk of executable code that hasn't yet been bound into a function.
Objek kode merupakan detail tingkat rendah dari implementasi CPython. Masing-masing mewakili sekumpulan kode yang dapat dieksekusi dimana belum terikat ke fungsi.
The C structure of the objects used to describe code objects. The fields of this type are subject to change at any time.
Struktur C dari objek yang digunakan untuk menggambarkan objek kode. Jenis dari tipe ini dapat berubah sewaktu-waktu.
Users of this API should not rely on internal runtime implementation details. Such details may include, but are not limited to, the exact order and timing of creation and destruction of code objects. While changes in these details may result in differences observable by watchers (including whether a callback is invoked or not), it does not change the semantics of the Python code being executed.
Code objects contain a bit-field of flags, which can be retrieved as the :attr:`~codeobject.co_flags` Python attribute (for example using :c:func:`PyObject_GetAttrString`), and set using a *flags* argument to :c:func:`PyUnstable_Code_New` and similar functions.
To support low-level extensions to frame evaluation, such as external just-in-time compilers, it is possible to attach arbitrary extra data to code objects.
Return a new opaque index value used to adding data to code objects.
You generally call this function once (per interpreter). Use the result with :c:func:`PyUnstable_Code_GetExtra` and :c:func:`PyUnstable_Code_SetExtra` to manipulate data on individual code objects.