@@ -439,6 +439,8 @@ msgid ""
439439"exporter MAY provide either a read-only or writable buffer, but the choice "
440440"MUST be consistent for all consumers."
441441msgstr ""
442+ "控制 :c:member:`~Py_buffer.readonly` 字段。如果设置了,输出程序 *必须* "
443+ "提供一个可写的缓冲区,否则报告失败。若未设置,输出程序 *可以* 提供只读或可写的缓冲区,但对所有消费者程序 *必须* 保持一致。"
442444
443445#: ../../c-api/buffer.rst:250
444446msgid ""
@@ -454,6 +456,8 @@ msgid ""
454456":c:macro:`PyBUF_WRITABLE` can be used as a stand-alone flag to request a "
455457"simple writable buffer."
456458msgstr ""
459+ ":c:macro:`PyBUF_WRITABLE` 可以和下一节的所有标志联用。由于 :c:macro:`PyBUF_SIMPLE` 定义为 0,所以 "
460+ ":c:macro:`PyBUF_WRITABLE` 可以作为一个独立的标志,用于请求一个简单的可写缓冲区。"
457461
458462#: ../../c-api/buffer.rst:258
459463msgid ""
@@ -577,7 +581,7 @@ msgstr "所有可能的请求都由上一节中某些标志的组合完全定义
577581msgid ""
578582"In the following table *U* stands for undefined contiguity. The consumer "
579583"would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity."
580- msgstr ""
584+ msgstr "在下表中,*U* 代表连续性未定义。消费者程序必须调用 :c:func:`PyBuffer_IsContiguous` 以确定连续性。 "
581585
582586#: ../../c-api/buffer.rst:321
583587msgid "readonly"
@@ -617,6 +621,9 @@ msgid ""
617621":c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, "
618622":c:member:`~Py_buffer.shape` and :c:member:`~Py_buffer.strides`."
619623msgstr ""
624+ "NumPy 风格数组的逻辑结构由 :c:member:`~Py_buffer.itemsize` 、 "
625+ ":c:member:`~Py_buffer.ndim` 、 :c:member:`~Py_buffer.shape` 和 "
626+ ":c:member:`~Py_buffer.strides` 定义。"
620627
621628#: ../../c-api/buffer.rst:350
622629msgid ""
@@ -626,20 +633,25 @@ msgid ""
626633":c:member:`~Py_buffer.shape` and :c:member:`~Py_buffer.strides` are "
627634"``NULL``."
628635msgstr ""
636+ "如果 ``ndim == 0`` , :c:member:`~Py_buffer.buf` 指向的内存位置被解释为大小为 "
637+ ":c:member:`~Py_buffer.itemsize` 的标量。这时, :c:member:`~Py_buffer.shape` 和 "
638+ ":c:member:`~Py_buffer.strides` 都为 ``NULL``。"
629639
630640#: ../../c-api/buffer.rst:354
631641msgid ""
632642"If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a"
633643" standard n-dimensional C-array. Otherwise, the consumer must access an "
634644"n-dimensional array as follows:"
635645msgstr ""
646+ "如果 :c:member:`~Py_buffer.strides` 为 ``NULL``,则数组将被解释为一个标准的 n 维 C "
647+ "语言数组。否则,消费者程序必须按如下方式访问 n 维数组:"
636648
637649#: ../../c-api/buffer.rst:364
638650msgid ""
639651"As noted above, :c:member:`~Py_buffer.buf` can point to any location within "
640652"the actual memory block. An exporter can check the validity of a buffer with"
641653" this function:"
642- msgstr ""
654+ msgstr "如上所述,:c:member:`~Py_buffer.buf` 可以指向实际内存块中的任意位置。输出者程序可以用该函数检查缓冲区的有效性。 "
643655
644656#: ../../c-api/buffer.rst:398
645657msgid "PIL-style: shape, strides and suboffsets"
@@ -680,6 +692,8 @@ msgid ""
680692"``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` "
681693"will succeed. This function always succeeds."
682694msgstr ""
695+ "如果 *obj* 支持缓冲区接口,则返回 ``1``,否则返回 ``0``。 返回 ``1`` 时不保证 "
696+ ":c:func:`PyObject_GetBuffer` 一定成功。本函数一定调用成功。"
683697
684698#: ../../c-api/buffer.rst:439
685699msgid ""
@@ -705,6 +719,9 @@ msgid ""
705719":c:func:`free`. Thus, after the consumer is done with the buffer, "
706720":c:func:`PyBuffer_Release` must be called exactly once."
707721msgstr ""
722+ ":c:func:`PyObject_GetBuffer` 必须与 :c:func:`PyBuffer_Release` 同时调用成功,类似于 "
723+ ":c:func:`malloc` 和 :c:func:`free`。因此,消费者程序用完缓冲区后, :c:func:`PyBuffer_Release`"
724+ " 必须保证被调用一次。"
708725
709726#: ../../c-api/buffer.rst:457
710727msgid ""
0 commit comments