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
The first three of these functions described, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell the function about the expected arguments. The format strings use the same syntax for each of these functions.
Tiga fungsi pertama dijelaskan yaitu, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, dan :c:func:`PyArg_Parse`, semuanya menggunakan *format string* yang digunakan untuk memberitahu fungsi tentang expected argumen . Format string menggunakan sintaks yang sama untuk setiap fungsi tersebut.
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 requires two arguments. The first is only used as input, and must be a :c:expr:`const char*` which points to the name of an encoding as a NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used. An exception is raised if the named encoding is not known to Python. The second argument must be a :c:expr:`char**`; the value of the pointer it references will be set to a buffer with the contents of the argument text. The text will be encoded in the encoding specified by the first argument.
Format ini membutuhkan dua argumen. Yang pertama hanya digunakan sebagai masukan, dan harus berupa :c:expr:`const char*` yang menunjuk pada nama pengkodean sebagai string yang diakhiri dengan NUL, atau ``NULL``, dalam hal ini pengkodean ``'utf-8'`` yang digunakan. Pengecualian akan muncul jika pengkodean yang disebutkan tidak dikenal oleh Python. Argumen kedua harus berupa :c:expr:`char**`; nilai pointer yang direferensikan akan diset ke buffer dengan isi teks argumen. Teks akan dikodekan dalam pengkodean yang ditentukan oleh argumen pertama.
It requires three arguments. The first is only used as input, and must be a :c:expr:`const char*` which points to the name of an encoding as a NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used. An exception is raised if the named encoding is not known to Python. The second argument must be a :c:expr:`char**`; the value of the pointer it references will be set to a buffer with the contents of the argument text. The text will be encoded in the encoding specified by the first argument. The third argument must be a pointer to an integer; the referenced integer will be set to the number of bytes in the output buffer.
Ini membutuhkan tiga argumen. Yang pertama hanya digunakan sebagai masukan, dan harus berupa :c:expr:`const char*` yang menunjuk pada nama pengkodean sebagai string yang diakhiri dengan NUL, atau ``NULL``, dalam hal ini pengkodean ``'utf-8'`` yang digunakan. Pengecualian akan muncul jika pengkodean yang disebutkan tidak dikenal oleh Python. Argumen kedua harus berupa :c:expr:`char**`; nilai pointer yang direferensikan akan disetel ke buffer dengan isi teks argumen. Teks akan dikodekan dalam pengkodean yang ditentukan oleh argumen pertama. Argumen ketiga harus berupa penunjuk ke sebuah bilangan bulat; bilangan bulat yang direferensikan akan diset ke jumlah byte dalam buffer keluaran.
Store a Python object in a C object pointer. This is similar to ``O``, but takes two C arguments: the first is the address of a Python type object, the second is the address of the C variable (of type :c:expr:`PyObject*`) into which the object pointer is stored. If the Python object does not have the required type, :exc:`TypeError` is raised.
Menyimpan objek Python dalam penunjuk objek C. Ini mirip dengan ``O``, tetapi membutuhkan dua argumen C: yang pertama adalah alamat objek tipe Python, yang kedua adalah alamat variabel C (bertipe :c:expr:`PyObject*`) tempat penunjuk objek disimpan. Jika objek Python tidak memiliki tipe yang dibutuhkan, :exc:`TypeError` akan ditampilkan.
Convert a Python object to a C variable through a *converter* function. This takes two arguments: the first is a function, the second is the address of a C variable (of arbitrary type), converted to :c:expr:`void *`. The *converter* function in turn is called as follows::
Mengonversi objek Python ke variabel C melalui fungsi *converter*. Ini membutuhkan dua argumen: yang pertama adalah fungsi, yang kedua adalah alamat variabel C (dari tipe sembarang), yang dikonversi menjadi :c:expr:`void *`. Fungsi *converter* pada gilirannya dipanggil sebagai berikut::