@@ -482,6 +482,10 @@ msgid ""
482482"The third argument must be a pointer to an integer; the referenced integer "
483483"will be set to the number of bytes in the output buffer."
484484msgstr ""
485+ "它需要三个参数。 第一个仅用作输入,并且必须为 :c:type:`const char*`,它指向一个编码格式名称,形式为以 NUL 结束的字符串或 "
486+ "``NULL``,在后一种情况下将使用 ``'utf-8'`` 编码格式。 如果编码格式名称无法被 Python 识别则会引发异常。 第二个参数必须为 "
487+ ":c:type:`char**`;它所引用的指针值将被设为带有参数文本内容的缓冲区。 文本将以第一个参数所指定的编码格式进行编码。 "
488+ "第三个参数必须为指向一个整数的指针;被引用的整数将被设为输出缓冲区中的字节数。"
485489
486490#: ../../c-api/arg.rst:231
487491msgid "There are two modes of operation:"
@@ -716,6 +720,9 @@ msgid ""
716720"which the object pointer is stored. If the Python object does not have the "
717721"required type, :exc:`TypeError` is raised."
718722msgstr ""
723+ "将一个 Python 对象存入一个 C 对象指针。 这类似于 ``O``,但是接受两个 C 参数:第一个是 Python "
724+ "类型对象的地址,第二个是存储对象指针的 C 变量 (类型为 :c:type:`PyObject*`) 的地址。 如果 Python "
725+ "对象不具有所要求的类型,则会引发 :exc:`TypeError`."
719726
720727#: ../../c-api/arg.rst:352 ../../c-api/arg.rst:657
721728msgid "``O&`` (object) [*converter*, *anything*]"
@@ -728,6 +735,8 @@ msgid ""
728735" of a C variable (of arbitrary type), converted to :c:type:`void *`. The "
729736"*converter* function in turn is called as follows::"
730737msgstr ""
738+ "通过一个 *converter* 函数将一个 Python 对象转换为一个 C 变量。 此函数接受两个参数:第一个是函数,第二个是 C 变量 "
739+ "(类型任意) 的地址,转换为 :c:type:`void *` 类型。 *converter* 函数将以如下方式被调用::"
731740
732741#: ../../c-api/arg.rst:339
733742msgid ""
@@ -738,6 +747,9 @@ msgid ""
738747"*converter* function should raise an exception and leave the content of "
739748"*address* unmodified."
740749msgstr ""
750+ "其中 *object* 是待转换的 Python 对象而 *address* 为传给 :c:func:`PyArg_Parse\\ *` 函数的 "
751+ ":c:type:`void*` 参数。 返回的 *status* 应当以 ``1`` 代表转换成功而以 ``0`` 代表转换失败。 "
752+ "当转换失败时,*converter* 函数应当引发异常并且会让 *address* 的内容保持未修改状态。"
741753
742754#: ../../c-api/arg.rst:345
743755msgid ""
@@ -1263,6 +1275,8 @@ msgid ""
12631275":c:type:`void*`) as its argument and should return a \" new\" Python object, "
12641276"or ``NULL`` if an error occurred."
12651277msgstr ""
1278+ "通过 *converter* 函数将 *anything* 转换为 Python 对象。 该函数调用时会传入 *anything* (应与 "
1279+ ":c:type:`void*` 兼容) 作为参数并且应当返回一个“新的”Python 对象,或者当发生错误时返回 ``NULL``。"
12661280
12671281#: ../../c-api/arg.rst:660
12681282msgid ""
0 commit comments