GitHub Viewer
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR , YEAR.
#
# Translators:
# python-doc bot, 2026
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-10-17 16:44+0000\n"
"PO-Revision-Date: 2025-09-16 00:00+0000\n"
"Last-Translator: python-doc bot, 2026\n"
"Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/"
"ja/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ja\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../c-api/bytes.rst:6
msgid "Bytes Objects"
msgstr "バイトオブジェクト"
#: ../../c-api/bytes.rst:8
msgid ""
"These functions raise :exc:`TypeError` when expecting a bytes parameter and "
"called with a non-bytes parameter."
msgstr ""
"下記の関数は、バイトオブジェクトを期待している引数にバイトオブジェクトでない"
"パラメタを指定して呼び出されると、 :exc:`TypeError` を送出します。"
#: ../../c-api/bytes.rst:13
msgid ""
"The internal buffer of :c:type:`PyBytesObject` always includes an extra "
"trailing null byte for compatibility with null terminated C strings. This "
"extra byte is not counted in :c:func:`PyBytes_Size` nor in the various "
"*length* and *size* arguments of the functions below."
msgstr ""
#: ../../c-api/bytes.rst:23
msgid "This subtype of :c:type:`PyObject` represents a Python bytes object."
msgstr ""
"この :c:type:`PyObject` のサブタイプは、Python バイトオブジェクトを表します。"
#: ../../c-api/bytes.rst:28
msgid ""
"This instance of :c:type:`PyTypeObject` represents the Python bytes type; it "
"is the same object as :class:`bytes` in the Python layer."
msgstr ""
"この :c:type:`PyTypeObject` のインスタンスは、Python バイト型を表します; "
"Pythonレイヤの :class:`bytes` と同じオブジェクトです。"
#: ../../c-api/bytes.rst:34
msgid ""
"Return true if the object *o* is a bytes object or an instance of a subtype "
"of the bytes type. This function always succeeds."
msgstr ""
"オブジェクト *o* が bytes オブジェクトか bytes 型のサブタイプのインスタンスで"
"ある場合に真を返します。この関数は常に成功します。"
#: ../../c-api/bytes.rst:40
msgid ""
"Return true if the object *o* is a bytes object, but not an instance of a "
"subtype of the bytes type. This function always succeeds."
msgstr ""
"オブジェクト *o* が bytes オブジェクトだが bytes 型のサブタイプのインスタンス"
"でない場合に真を返します。この関数は常に成功します。"
#: ../../c-api/bytes.rst:46
msgid ""
"Return a new bytes object with a copy of the string *v* as value on success, "
"and ``NULL`` on failure. The parameter *v* must not be ``NULL``; it will "
"not be checked."
msgstr ""
"成功時に、文字列 *v* のコピーを値とする新しいバイトオブジェクトを返し、失敗時"
"に ``NULL`` を返します。\n"
"引数 *v* は ``NULL`` であってはなりません; そのチェックは行われません。"
#: ../../c-api/bytes.rst:53
msgid ""
"Return a new bytes object with a copy of the string *v* as value and length "
"*len* on success, and ``NULL`` on failure. If *v* is ``NULL``, the contents "
"of the bytes object are uninitialized."
msgstr ""
"成功時に、文字列 *v* のコピーを値とする長さ *len* の新しいバイトオブジェクト"
"を返し、失敗時に ``NULL`` を返します。\n"
"引数 *v* が ``NULL`` の場合、バイトオブジェクトの中身は初期化されていません。"
#: ../../c-api/bytes.rst:57
msgid ""
"Use the :c:type:`PyBytesWriter` API instead of "
"``PyBytes_FromStringAndSize(NULL, len)``."
msgstr ""
#: ../../c-api/bytes.rst:64
msgid ""
"Take a C :c:func:`printf`\\ -style *format* string and a variable number of "
"arguments, calculate the size of the resulting Python bytes object and "
"return a bytes object with the values formatted into it. The variable "
"arguments must be C types and must correspond exactly to the format "
"characters in the *format* string. The following format characters are "
"allowed:"
msgstr ""
"C 関数の :c:func:`printf` スタイルの *format* 文字列と可変長の引数を取り、結"
"果のPython バイトオブジェクトのサイズを計算し、値を指定した書式にしたがって変"
"換したバイトオブジェクトを返します。可変長の引数は C のデータ型でなければなら"
"ず、 *format* 文字列中のフォーマット文字と厳密に関連付けられていなければなり"
"ません。下記のフォーマット文字が使用できます:"
#: ../../c-api/bytes.rst:76
msgid "Format Characters"
msgstr "書式指定文字"
#: ../../c-api/bytes.rst:76
msgid "Type"
msgstr "型"
#: ../../c-api/bytes.rst:76
msgid "Comment"
msgstr "備考"
#: ../../c-api/bytes.rst:78
msgid "``%%``"
msgstr "``%%``"
#: ../../c-api/bytes.rst:78
msgid "*n/a*"
msgstr "*n/a*"
#: ../../c-api/bytes.rst:78
msgid "The literal % character."
msgstr "リテラルの % 文字"
#: ../../c-api/bytes.rst:80
msgid "``%c``"
msgstr "``%c``"
#: ../../c-api/bytes.rst:80 ../../c-api/bytes.rst:83 ../../c-api/bytes.rst:101
#: ../../c-api/bytes.rst:104
msgid "int"
msgstr "int"
#: ../../c-api/bytes.rst:80
msgid "A single byte, represented as a C int."
msgstr "C の整数型で表現される単一のバイト。"
#: ../../c-api/bytes.rst:83
msgid "``%d``"
msgstr "``%d``"
#: ../../c-api/bytes.rst:83
msgid "Equivalent to ``printf(\"%d\")``. [1]_"
msgstr "``printf(\"%d\")`` と同等。 [1]_"
#: ../../c-api/bytes.rst:86
msgid "``%u``"
msgstr "``%u``"
#: ../../c-api/bytes.rst:86
msgid "unsigned int"
msgstr "unsigned int"
#: ../../c-api/bytes.rst:86
msgid "Equivalent to ``printf(\"%u\")``. [1]_"
msgstr "``printf(\"%u\")`` と同等。 [1]_"
#: ../../c-api/bytes.rst:89
msgid "``%ld``"
msgstr "``%ld``"
#: ../../c-api/bytes.rst:89
msgid "long"
msgstr "long"
#: ../../c-api/bytes.rst:89
msgid "Equivalent to ``printf(\"%ld\")``. [1]_"
msgstr "``printf(\"%ld\")`` と同等。 [1]_"
#: ../../c-api/bytes.rst:92
msgid "``%lu``"
msgstr "``%lu``"
#: ../../c-api/bytes.rst:92
msgid "unsigned long"
msgstr "unsigned long"
#: ../../c-api/bytes.rst:92
msgid "Equivalent to ``printf(\"%lu\")``. [1]_"
msgstr "``printf(\"%lu\")`` と同等。 [1]_"
#: ../../c-api/bytes.rst:95
msgid "``%zd``"
msgstr "``%zd``"
#: ../../c-api/bytes.rst:95
msgid ":c:type:`\\ Py_ssize_t`"
msgstr ":c:type:`\\ Py_ssize_t`"
#: ../../c-api/bytes.rst:95
msgid "Equivalent to ``printf(\"%zd\")``. [1]_"
msgstr "``printf(\"%zd\")`` と同等。 [1]_"
#: ../../c-api/bytes.rst:98
msgid "``%zu``"
msgstr "``%zu``"
#: ../../c-api/bytes.rst:98
msgid "size_t"
msgstr "size_t"
#: ../../c-api/bytes.rst:98
msgid "Equivalent to ``printf(\"%zu\")``. [1]_"
msgstr "``printf(\"%zu\")`` と同等。 [1]_"
#: ../../c-api/bytes.rst:101
msgid "``%i``"
msgstr "``%i``"
#: ../../c-api/bytes.rst:101
msgid "Equivalent to ``printf(\"%i\")``. [1]_"
msgstr "``printf(\"%i\")`` と同等。 [1]_"
#: ../../c-api/bytes.rst:104
msgid "``%x``"
msgstr "``%x``"
#: ../../c-api/bytes.rst:104
msgid "Equivalent to ``printf(\"%x\")``. [1]_"
msgstr "``printf(\"%x\")`` と同等。 [1]_"
#: ../../c-api/bytes.rst:107
msgid "``%s``"
msgstr "``%s``"
#: ../../c-api/bytes.rst:107
msgid "const char\\*"
msgstr "const char\\*"
#: ../../c-api/bytes.rst:107
msgid "A null-terminated C character array."
msgstr "null で終端された C の文字列。"
#: ../../c-api/bytes.rst:110
msgid "``%p``"
msgstr "``%p``"
#: ../../c-api/bytes.rst:110
msgid "const void\\*"
msgstr "const void\\*"
#: ../../c-api/bytes.rst:110
msgid ""
"The hex representation of a C pointer. Mostly equivalent to "
"``printf(\"%p\")`` except that it is guaranteed to start with the literal "
"``0x`` regardless of what the platform's ``printf`` yields."
msgstr ""
"C ポインタの 16 進表記。``printf(\"%p\")`` とほとんど同じですが、プラット"
"フォームにおける ``printf`` の定義に関わりなく先頭にリテラル ``0x`` が付きま"
"す。"
#: ../../c-api/bytes.rst:119
msgid ""
"An unrecognized format character causes all the rest of the format string to "
"be copied as-is to the result object, and any extra arguments discarded."
msgstr ""
"識別できない書式指定文字があった場合、残りの書式文字列はそのまま結果のオブ"
"ジェクトにコピーされ、残りの引数は無視されます。"
#: ../../c-api/bytes.rst:122
msgid ""
"For integer specifiers (d, u, ld, lu, zd, zu, i, x): the 0-conversion flag "
"has effect even when a precision is given."
msgstr ""
"整数指定子 (d, u, ld, lu, zd, zu, i, x): 精度が与えられていても、0指定子は有"
"効です。"
#: ../../c-api/bytes.rst:128
msgid ""
"Identical to :c:func:`PyBytes_FromFormat` except that it takes exactly two "
"arguments."
msgstr ""
"ちょうど2つの引数を取ることを除いて、 :c:func:`PyBytes_FromFormat` と同じで"
"す。"
#: ../../c-api/bytes.rst:134
msgid ""
"Return the bytes representation of object *o* that implements the buffer "
"protocol."
msgstr "バッファプロトコルを実装するオブジェクト *o* のバイト表現を返します。"
#: ../../c-api/bytes.rst:138
msgid ""
"If the object implements the buffer protocol, then the buffer must not be "
"mutated while the bytes object is being created."
msgstr ""
#: ../../c-api/bytes.rst:144
msgid "Return the length of the bytes in bytes object *o*."
msgstr "バイトオブジェクト *o* のバイト単位の長さを返します。"
#: ../../c-api/bytes.rst:149
msgid "Similar to :c:func:`PyBytes_Size`, but without error checking."
msgstr ":c:func:`PyBytes_Size` に似ていますが、エラーチェックを行いません。"
#: ../../c-api/bytes.rst:154
msgid ""
"Return a pointer to the contents of *o*. The pointer refers to the internal "
"buffer of *o*, which consists of ``len(o) + 1`` bytes. The last byte in the "
"buffer is always null, regardless of whether there are any other null "
"bytes. The data must not be modified in any way, unless the object was just "
"created using ``PyBytes_FromStringAndSize(NULL, size)``. It must not be "
"deallocated. If *o* is not a bytes object at all, :c:func:"
"`PyBytes_AsString` returns ``NULL`` and raises :exc:`TypeError`."
msgstr ""
"*o* の中身へのポインタを返します。\n"
"ポインタは、 ``len(o) + 1`` バイトからなる *o* の内部バッファを参照します。\n"
"他に null のバイトがあるかどうかにかかわらず、バッファの最後のバイトは必ず "
"null になります。\n"
"``PyBytes_FromStringAndSize(NULL, size)`` で生成された場合を除いて、データを"
"修正してはなりません。\n"
"またポインタを解放(deallocated)してはなりません。\n"
"もし、 *o* が bytes オブジェクトでなければ、 :c:func:`PyBytes_AsString` は "
"``NULL`` を返し :exc:`TypeError` を送出します。"
#: ../../c-api/bytes.rst:166
msgid "Similar to :c:func:`PyBytes_AsString`, but without error checking."
msgstr ""
":c:func:`PyBytes_AsString` に似ていますが、エラーチェックを行いません。"
#: ../../c-api/bytes.rst:171
msgid ""
"Return the null-terminated contents of the object *obj* through the output "
"variables *buffer* and *length*. Returns ``0`` on success."
msgstr ""
#: ../../c-api/bytes.rst:175
msgid ""
"If *length* is ``NULL``, the bytes object may not contain embedded null "
"bytes; if it does, the function returns ``-1`` and a :exc:`ValueError` is "
"raised."
msgstr ""
"*length* の値が ``NULL`` の場合、バイトオブジェクトが null バイトを含まない"
"可能性があります。その場合、関数は ``-1`` を返し、 :exc:`ValueError` を送出し"
"ます。"
#: ../../c-api/bytes.rst:179
msgid ""
"The buffer refers to an internal buffer of *obj*, which includes an "
"additional null byte at the end (not counted in *length*). The data must "
"not be modified in any way, unless the object was just created using "
"``PyBytes_FromStringAndSize(NULL, size)``. It must not be deallocated. If "
"*obj* is not a bytes object at all, :c:func:`PyBytes_AsStringAndSize` "
"returns ``-1`` and raises :exc:`TypeError`."
msgstr ""
"buffer は *obj* の内部バッファを参照していて、これには末尾の null バイトも含"
"んでいます (これは *length* には数えられません)。\n"
"オブジェクトが ``PyBytes_FromStringAndSize(NULL, size)`` で生成された場合を除"
"いて、何があってもデータを改変してはいけません。\n"
"オブジェクトを解放 (deallocate) してもいけません。\n"
"*obj* が bytes オブジェクトでなかった場合は、 :c:func:"
"`PyBytes_AsStringAndSize` は ``-1`` を返し :exc:`TypeError` を送出します。"
#: ../../c-api/bytes.rst:186
msgid ""
"Previously, :exc:`TypeError` was raised when embedded null bytes were "
"encountered in the bytes object."
msgstr ""
"以前は bytes オブジェクトにヌルバイトが埋め込まれていたときに :exc:"
"`TypeError` を送出していました。"
#: ../../c-api/bytes.rst:193
msgid ""
"Create a new bytes object in *\\*bytes* containing the contents of *newpart* "
"appended to *bytes*; the caller will own the new reference. The reference to "
"the old value of *bytes* will be \":term:`stolen `\". If the new "
"object cannot be created, the old reference to *bytes* will still be "
"\"stolen\", the value of *\\*bytes* will be set to ``NULL``, and the "
"appropriate exception will be set."
msgstr ""
#: ../../c-api/bytes.rst:201 ../../c-api/bytes.rst:211
msgid ""
"If *newpart* implements the buffer protocol, then the buffer must not be "
"mutated while the new bytes object is being created."
msgstr ""
#: ../../c-api/bytes.rst:206
msgid ""
"Create a new bytes object in *\\*bytes* containing the contents of *newpart* "
"appended to *bytes*. This version releases the :term:`strong reference` to "
"*newpart* (i.e. decrements its reference count)."
msgstr ""
#: ../../c-api/bytes.rst:217
msgid "Similar to ``sep.join(iterable)`` in Python."
msgstr ""
#: ../../c-api/bytes.rst:219
msgid ""
"*sep* must be Python :class:`bytes` object. (Note that :c:func:"
"`PyUnicode_Join` accepts ``NULL`` separator and treats it as a space, "
"whereas :c:func:`PyBytes_Join` doesn't accept ``NULL`` separator.)"
msgstr ""
#: ../../c-api/bytes.rst:224
msgid ""
"*iterable* must be an iterable object yielding objects that implement the :"
"ref:`buffer protocol `."
msgstr ""
#: ../../c-api/bytes.rst:227
msgid ""
"On success, return a new :class:`bytes` object. On error, set an exception "
"and return ``NULL``."
msgstr ""
#: ../../c-api/bytes.rst:233
msgid ""
"If *iterable* objects implement the buffer protocol, then the buffers must "
"not be mutated while the new bytes object is being created."
msgstr ""
#: ../../c-api/bytes.rst:238
msgid ""
"Resize a bytes object. *newsize* will be the new length of the bytes object. "
"You can think of it as creating a new bytes object and destroying the old "
"one, only more efficiently. Pass the address of an existing bytes object as "
"an lvalue (it may be written into), and the new size desired. On success, "
"*\\*bytes* holds the resized bytes object and ``0`` is returned; the address "
"in *\\*bytes* may differ from its input value. If the reallocation fails, "
"the original bytes object at *\\*bytes* is deallocated, *\\*bytes* is set to "
"``NULL``, :exc:`MemoryError` is set, and ``-1`` is returned."
msgstr ""
#: ../../c-api/bytes.rst:249
msgid "Use the :c:type:`PyBytesWriter` API instead."
msgstr ""
#: ../../c-api/bytes.rst:255
msgid ""
"Get the string representation of *bytes*. This function is currently used to "
"implement :meth:`!bytes.__repr__` in Python."
msgstr ""
#: ../../c-api/bytes.rst:258
msgid ""
"This function does not do type checking; it is undefined behavior to pass "
"*bytes* as a non-bytes object or ``NULL``."
msgstr ""
#: ../../c-api/bytes.rst:261
msgid ""
"If *smartquotes* is true, the representation will use a double-quoted string "
"instead of single-quoted string when single-quotes are present in *bytes*. "
"For example, the byte string ``'Python'`` would be represented as "
"``b\"'Python'\"`` when *smartquotes* is true, or ``b'\\'Python\\''`` when it "
"is false."
msgstr ""
#: ../../c-api/bytes.rst:267
msgid ""
"On success, this function returns a :term:`strong reference` to a :class:"
"`str` object containing the representation. On failure, this returns "
"``NULL`` with an exception set."
msgstr ""
#: ../../c-api/bytes.rst:274
msgid ""
"Unescape a backslash-escaped string *s*. *s* must not be ``NULL``. *len* "
"must be the size of *s*."
msgstr ""
#: ../../c-api/bytes.rst:277
msgid ""
"*errors* must be one of ``\"strict\"``, ``\"replace\"``, or ``\"ignore\"``. "
"If *errors* is ``NULL``, then ``\"strict\"`` is used by default."
msgstr ""
#: ../../c-api/bytes.rst:280
msgid ""
"On success, this function returns a :term:`strong reference` to a Python :"
"class:`bytes` object containing the unescaped string. On failure, this "
"function returns ``NULL`` with an exception set."
msgstr ""
#: ../../c-api/bytes.rst:284
msgid "*unicode* and *recode_encoding* are now unused."
msgstr ""
#: ../../c-api/bytes.rst:291
msgid "PyBytesWriter"
msgstr ""
#: ../../c-api/bytes.rst:293
msgid ""
"The :c:type:`PyBytesWriter` API can be used to create a Python :class:"
"`bytes` object."
msgstr ""
#: ../../c-api/bytes.rst:300
msgid "A bytes writer instance."
msgstr ""
#: ../../c-api/bytes.rst:302
msgid ""
"The API is **not thread safe**. To share a writer with multiple threads, a "
"critical section or a lock is needed."
msgstr ""
#: ../../c-api/bytes.rst:305
msgid ""
"The instance must be destroyed by :c:func:`PyBytesWriter_Finish` on success, "
"or :c:func:`PyBytesWriter_Discard` on error."
msgstr ""
#: ../../c-api/bytes.rst:310
msgid "Create, Finish, Discard"
msgstr ""
#: ../../c-api/bytes.rst:314
msgid "Create a :c:type:`PyBytesWriter` to write *size* bytes."
msgstr ""
#: ../../c-api/bytes.rst:316
msgid ""
"If *size* is greater than zero, allocate *size* bytes, and set the writer "
"size to *size*. The caller is responsible to write *size* bytes using :c:"
"func:`PyBytesWriter_GetData`. This function does not overallocate."
msgstr ""
#: ../../c-api/bytes.rst:321 ../../c-api/bytes.rst:450
msgid "On error, set an exception and return ``NULL``."
msgstr ""
#: ../../c-api/bytes.rst:323 ../../c-api/bytes.rst:426
msgid "*size* must be positive or zero."
msgstr ""
#: ../../c-api/bytes.rst:327
msgid ""
"Finish a :c:type:`PyBytesWriter` created by :c:func:`PyBytesWriter_Create`."
msgstr ""
#: ../../c-api/bytes.rst:330
msgid ""
"On success, return a Python :class:`bytes` object. On error, set an "
"exception and return ``NULL``."
msgstr ""
#: ../../c-api/bytes.rst:333
msgid ""
"The writer instance is invalid after the call in any case. No API can be "
"called on the writer after :c:func:`PyBytesWriter_Finish`."
msgstr ""
#: ../../c-api/bytes.rst:338
msgid ""
"Similar to :c:func:`PyBytesWriter_Finish`, but resize the writer to *size* "
"bytes before creating the :class:`bytes` object."
msgstr ""
#: ../../c-api/bytes.rst:343
msgid ""
"Similar to :c:func:`PyBytesWriter_Finish`, but resize the writer using *buf* "
"pointer before creating the :class:`bytes` object."
msgstr ""
#: ../../c-api/bytes.rst:346
msgid ""
"Set an exception and return ``NULL`` if *buf* pointer is outside the "
"internal buffer bounds."
msgstr ""
#: ../../c-api/bytes.rst:349 ../../c-api/bytes.rst:454
msgid "Function pseudo-code::"
msgstr ""
#: ../../c-api/bytes.rst:351
msgid ""
"Py_ssize_t size = (char*)buf - (char*)PyBytesWriter_GetData(writer);\n"
"return PyBytesWriter_FinishWithSize(writer, size);"
msgstr ""
#: ../../c-api/bytes.rst:356
msgid ""
"Discard a :c:type:`PyBytesWriter` created by :c:func:`PyBytesWriter_Create`."
msgstr ""
#: ../../c-api/bytes.rst:358
msgid "Do nothing if *writer* is ``NULL``."
msgstr ""
#: ../../c-api/bytes.rst:360
msgid ""
"The writer instance is invalid after the call. No API can be called on the "
"writer after :c:func:`PyBytesWriter_Discard`."
msgstr ""
#: ../../c-api/bytes.rst:364
msgid "High-level API"
msgstr "高レベルAPI"
#: ../../c-api/bytes.rst:368
msgid ""
"Grow the *writer* internal buffer by *size* bytes, write *size* bytes of "
"*bytes* at the *writer* end, and add *size* to the *writer* size."
msgstr ""
#: ../../c-api/bytes.rst:372
msgid ""
"If *size* is equal to ``-1``, call ``strlen(bytes)`` to get the string "
"length."
msgstr ""
#: ../../c-api/bytes.rst:375 ../../c-api/bytes.rst:384
#: ../../c-api/bytes.rst:423 ../../c-api/bytes.rst:436
msgid "On success, return ``0``. On error, set an exception and return ``-1``."
msgstr ""
#: ../../c-api/bytes.rst:380
msgid ""
"Similar to :c:func:`PyBytes_FromFormat`, but write the output directly at "
"the writer end. Grow the writer internal buffer on demand. Then add the "
"written size to the writer size."
msgstr ""
#: ../../c-api/bytes.rst:389
msgid "Getters"
msgstr ""
#: ../../c-api/bytes.rst:393
msgid "Get the writer size."
msgstr ""
#: ../../c-api/bytes.rst:395
msgid ""
"The function does not invalidate pointers returned by :c:func:"
"`PyBytesWriter_GetData`."
msgstr ""
#: ../../c-api/bytes.rst:398 ../../c-api/bytes.rst:408
msgid "The function cannot fail."
msgstr ""
#: ../../c-api/bytes.rst:402
msgid "Get the writer data: start of the internal buffer."
msgstr ""
#: ../../c-api/bytes.rst:404
msgid ""
"The pointer remains valid until a :c:type:`PyBytesWriter` function other "
"than :c:func:`PyBytesWriter_GetData` or :c:func:`PyBytesWriter_GetSize` is "
"called on *writer*."
msgstr ""
#: ../../c-api/bytes.rst:412
msgid "Low-level API"
msgstr "低レベルAPI"
#: ../../c-api/bytes.rst:416
msgid ""
"Resize the writer to *size* bytes. It can be used to enlarge or to shrink "
"the writer. This function typically overallocates to achieve amortized "
"performance when resizing multiple times."
msgstr ""
#: ../../c-api/bytes.rst:421 ../../c-api/bytes.rst:434
msgid "Newly allocated bytes are left uninitialized."
msgstr ""
#: ../../c-api/bytes.rst:430
msgid ""
"Resize the writer by adding *grow* bytes to the current writer size. This "
"function typically overallocates to achieve amortized performance when "
"resizing multiple times."
msgstr ""
#: ../../c-api/bytes.rst:439
msgid "*grow* can be negative to shrink the writer."
msgstr ""
#: ../../c-api/bytes.rst:443
msgid ""
"Similar to :c:func:`PyBytesWriter_Grow`, but update also the *buf* pointer."
msgstr ""
#: ../../c-api/bytes.rst:446
msgid ""
"The *buf* pointer is moved if the internal buffer is moved in memory. The "
"*buf* relative position within the internal buffer is left unchanged."
msgstr ""
#: ../../c-api/bytes.rst:452
msgid "*buf* must not be ``NULL``."
msgstr ""
#: ../../c-api/bytes.rst:456
msgid ""
"Py_ssize_t pos = (char*)buf - (char*)PyBytesWriter_GetData(writer);\n"
"if (PyBytesWriter_Grow(writer, size) < 0) {\n"
" return NULL;\n"
"}\n"
"return (char*)PyBytesWriter_GetData(writer) + pos;"
msgstr ""
#: ../../c-api/bytes.rst:464
msgid "Example creating the string ``b'abc'``"
msgstr ""
#: ../../c-api/bytes.rst:466
msgid ""
"Example creating the bytes string ``b\"abc\"``, with a fixed size of 3 "
"bytes::"
msgstr ""
#: ../../c-api/bytes.rst:468
msgid ""
"PyObject* create_abc(void)\n"
"{\n"
" PyBytesWriter *writer = PyBytesWriter_Create(3);\n"
" if (writer == NULL) {\n"
" return NULL;\n"
" }\n"
"\n"
" char *str = PyBytesWriter_GetData(writer);\n"
" memcpy(str, \"abc\", 3);\n"
" return PyBytesWriter_Finish(writer);\n"
"}"
msgstr ""
#: ../../c-api/bytes.rst:480
msgid "Variant using a pointer to compute the final size::"
msgstr ""
#: ../../c-api/bytes.rst:482
msgid ""
"PyObject* create_abc_ptr(void)\n"
"{\n"
" PyBytesWriter *writer = PyBytesWriter_Create(3);\n"
" if (writer == NULL) {\n"
" return NULL;\n"
" }\n"
"\n"
" char *str = PyBytesWriter_GetData(writer);\n"
" memcpy(str, \"abc\", 3);\n"
" str += 1;\n"
" return PyBytesWriter_FinishWithPointer(writer, str);\n"
"}"
msgstr ""
#: ../../c-api/bytes.rst:497
msgid "Update ``PyBytes_FromStringAndSize()`` code"
msgstr ""
#: ../../c-api/bytes.rst:499
msgid ""
"Example of code using the soft deprecated ``PyBytes_FromStringAndSize(NULL, "
"size)`` API::"
msgstr ""
#: ../../c-api/bytes.rst:502
msgid ""
"int copy_bytes(char *dest, const char *src, Py_ssize_t num_bytes)\n"
"{\n"
" ...\n"
"}\n"
"\n"
"PyObject* create_string(const char *start, Py_ssize_t num_bytes)\n"
"{\n"
" PyObject *result = PyBytes_FromStringAndSize(NULL, num_bytes);\n"
" if (result == NULL) {\n"
" return NULL;\n"
" }\n"
" if (copy_bytes(PyBytes_AS_STRING(result), start, num_bytes) < 0) {\n"
" Py_CLEAR(result);\n"
" }\n"
" return result;\n"
"}"
msgstr ""
#: ../../c-api/bytes.rst:519 ../../c-api/bytes.rst:556
msgid "It can now be updated to::"
msgstr ""
#: ../../c-api/bytes.rst:521
msgid ""
"PyObject* create_string(const char *start, Py_ssize_t num_bytes)\n"
"{\n"
" PyBytesWriter *writer = PyBytesWriter_Create(num_bytes);\n"
" if (writer == NULL) {\n"
" return NULL;\n"
" }\n"
" if (copy_bytes(PyBytesWriter_GetData(writer), start, num_bytes) < 0) {\n"
" PyBytesWriter_Discard(writer);\n"
" return NULL;\n"
" }\n"
" return PyBytesWriter_Finish(writer);\n"
"}"
msgstr ""
#: ../../c-api/bytes.rst:536
msgid "Update ``_PyBytes_Resize()`` code"
msgstr ""
#: ../../c-api/bytes.rst:538
msgid "Example of code using the soft deprecated ``_PyBytes_Resize()`` API::"
msgstr ""
#: ../../c-api/bytes.rst:540
msgid ""
"void create_string(Py_ssize_t size)\n"
"{\n"
" PyObject *bytes = PyBytes_FromStringAndSize(NULL, size);\n"
" if (bytes == NULL) {\n"
" return NULL;\n"
" }\n"
" char *str = PyBytes_AS_STRING(bytes);\n"
"\n"
" // ... write data into str ...\n"
"\n"
" if (_PyBytes_Resize(&bytes, (str - PyBytes_AS_STRING(bytes)))) {\n"
" return NULL;\n"
" }\n"
" return bytes;\n"
"}"
msgstr ""
#: ../../c-api/bytes.rst:558
msgid ""
"void create_string(Py_ssize_t size)\n"
"{\n"
" PyBytesWriter *writer = PyBytesWriter_Create(size);\n"
" if (writer == NULL) {\n"
" return NULL;\n"
" }\n"
" char *str = PyBytesWriter_GetData(writer);\n"
"\n"
" // ... write data into str ...\n"
"\n"
" return PyBytesWriter_FinishWithPointer(writer, str);\n"
"}"
msgstr ""
#: ../../c-api/bytes.rst:18
msgid "object"
msgstr "object"
#: ../../c-api/bytes.rst:18
msgid "bytes"
msgstr "bytes"