Pelokalan
Python ID
id en
Masuk
Proyek
c-api__interp-lifecycle.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
When a flag is set by an option, the value of the flag is the number of times that the option was set. For example, ``-b`` sets :c:data:`Py_BytesWarningFlag` to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Other threads that attempt to attach during finalization, either explicitly (such as via :c:func:`PyThreadState_Ensure` or :c:macro:`Py_END_ALLOW_THREADS`) or implicitly (such as in-between bytecode instructions), will enter a **permanently blocked state**. Generally, this is harmless, but this can result in deadlocks. For example, a thread may be permanently blocked while holding a lock, meaning that the finalization thread can never acquire that lock.
For example:
Sebagai contoh:
// Temporarily prevent finalization. PyInterpreterGuard *guard = PyInterpreterGuard_FromCurrent(); if (guard == NULL) { // Finalization has already started or we're out of memory. return NULL; } Py_BEGIN_ALLOW_THREADS; // Do some critical processing here. For example, we can safely acquire // locks that might be acquired by the finalization thread. Py_END_ALLOW_THREADS; // Now that we're done with our critical processing, the interpreter is // allowed to finalize again. PyInterpreterGuard_Close(guard);
Return the official copyright string for the current Python version, for example
Return an indication of the compiler used to build the current Python version, in square brackets, for example::
Return information about the sequence number and build date and time of the current Python interpreter instance, for example ::
On versions before 3.1.3, you can achieve the same effect by manually popping the first :data:`sys.path` element after having called :c:func:`PySys_SetArgv`, for example using::