Pelokalan
Python ID
id en
Masuk
Proyek
c-api__arg.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
To ensure that the underlying buffer may be safely borrowed, the object's :c:member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This disallows common mutable objects such as :class:`bytearray`, but also some read-only objects such as :class:`memoryview` of :class:`bytes`.
Untuk memastikan bahwa buffer yang mendasari dapat dipinjam dengan aman, bidang :c:member:`PyBufferProcs.bf_releasebuffer` objek harus ``NULL``. Hal ini melarang objek umum yang dapat diubah seperti :class:`bytearray`, tetapi juga beberapa objek yang hanya dapat dibaca seperti :class:`memoryview` dari :class:`bytes`.
Convert a Unicode object to a C pointer to a character string. A pointer to an existing string is stored in the character pointer variable whose address you pass. The C string is NUL-terminated. The Python string must not contain embedded null code points; if it does, a :exc:`ValueError` exception is raised. Unicode objects are converted to C strings using ``'utf-8'`` encoding. If this conversion fails, a :exc:`UnicodeError` is raised.
This format does not accept :term:`bytes-like objects <bytes-like object>`. If you want to accept filesystem paths and convert them to C character strings, it is preferable to use the ``O&`` format with :c:func:`PyUnicode_FSConverter` as *converter*.
This format accepts Unicode objects as well as bytes-like objects. It fills a :c:type:`Py_buffer` structure provided by the caller. In this case the resulting C string may contain embedded NUL bytes. Unicode objects are converted to C strings using ``'utf-8'`` encoding.
Like ``s*``, except that it provides a :ref:`borrowed buffer <c-arg-borrowed-buffer>`. The result is stored into two C variables, the first one a pointer to a C string, the second one its length. The string may contain embedded null bytes. Unicode objects are converted to C strings using ``'utf-8'`` encoding.
Seperti ``s*``, kecuali bahwa ia menyediakan buffer :ref:`pinjaman <c-arg-borrowed-buffer>`. Hasilnya disimpan ke dalam dua variabel C, yang pertama adalah penunjuk ke sebuah string C, yang kedua adalah panjangnya. String tersebut dapat berisi byte null yang disematkan. Objek Unicode dikonversi ke string C menggunakan pengkodean ``'utf-8'``.
This format converts a bytes-like object to a C pointer to a :ref:`borrowed <c-arg-borrowed-buffer>` character string; it does not accept Unicode objects. The bytes buffer must not contain embedded null bytes; if it does, a :exc:`ValueError` exception is raised.
Format ini mengkonversi objek bytes-like ke C-pointer ke string karakter :ref:` yang dipinjam dari <c-arg-borrowed-buffer>`; format ini tidak menerima objek Unicode. Buffer byte tidak boleh berisi byte null yang disematkan; jika ya, pengecualian :exc:`ValueError` akan dimunculkan.
This variant on ``s*`` doesn't accept Unicode objects, only bytes-like objects. **This is the recommended way to accept binary data.**
This variant on ``s#`` doesn't accept Unicode objects, only bytes-like objects.
Varian pada ``s#`` ini tidak menerima objek Unicode, hanya objek yang seperti byte.
Same as ``es`` except that byte string objects are passed through without recoding them. Instead, the implementation assumes that the byte string object uses the encoding passed in as parameter.
Podobnie jak ``es`` z wyjątkiem tego, że obiekty ciągów znaków są przekazywane dalej bez ich zapisywania. Zamiast tego implementacja zakłada, że obiekt łańcucha znaków wykorzystuje kodowanie przekazane jako parametr.
Same as ``es#`` except that byte string objects are passed through without recoding them. Instead, the implementation assumes that the byte string object uses the encoding passed in as parameter.
Tak samo, jak w ``es#`` oprócz tego, że obiekty ciągu bajtów są przekazywane do funkcji bez ich zapisywania. Zamiast tego, implementacja zakłada że obiekt ciągu bajtów używa kodowania przekazywanego w parametrze.
Allow :class:`bytearray` objects.
Izinkan objek :class:`bytearray`.
Other objects
Objek lain
:class:`str` and :class:`bytearray` objects no longer accepted as a sequence.
:class:`str` dan :class:`bytearray` tidak lagi diterima sebagai sebuah urutan.
When memory buffers are passed as parameters to supply data to build objects, as for the ``s`` and ``s#`` formats, the required data is copied. Buffers provided by the caller are never referenced by the objects created by :c:func:`Py_BuildValue`. In other words, if your code invokes :c:func:`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`, your code is responsible for calling :c:func:`free` for that memory once :c:func:`Py_BuildValue` returns.