@@ -3679,18 +3679,18 @@ msgstr ""
3679
3679
msgid ""
3680
3680
"If *size* is not given (or if it is ``None``), the buffer is made one "
3681
3681
"element larger than *init*, effectively adding a NUL terminator."
3682
- msgstr ""
3682
+ msgstr "如果未给出 *size* (或者为 ``None``),缓冲区将设为比 *init* 大一个元素,实际就是增加一个 NUL 结束符。 "
3683
3683
3684
3684
#: ../../library/ctypes.rst:1959
3685
3685
msgid ""
3686
3686
"If both arguments are given, *size* must not be less than ``len(init)``."
3687
- msgstr ""
3687
+ msgstr "如果同时给出两个参数,则 *size* 必须不小于 ``len(init)``。 "
3688
3688
3689
3689
#: ../../library/ctypes.rst:1963
3690
3690
msgid ""
3691
3691
"If *size* is equal to ``len(init)``, a NUL terminator is not added. Do not "
3692
3692
"treat such a buffer as a C string."
3693
- msgstr ""
3693
+ msgstr "如果 *size* 等于 ``len(init)``,则不会增加一个 NUL 结束符。 不可将这样的缓冲区视为 C 字符串。 "
3694
3694
3695
3695
#: ../../library/ctypes.rst:1966
3696
3696
msgid "For example::"
@@ -3711,6 +3711,18 @@ msgid ""
3711
3711
" ...\n"
3712
3712
"ValueError: byte string too long"
3713
3713
msgstr ""
3714
+ ">>> bytes(create_string_buffer(2))\n"
3715
+ "b'\\ x00\\ x00'\n"
3716
+ ">>> bytes(create_string_buffer(b'ab'))\n"
3717
+ "b'ab\\ x00'\n"
3718
+ ">>> bytes(create_string_buffer(b'ab', 2))\n"
3719
+ "b'ab'\n"
3720
+ ">>> bytes(create_string_buffer(b'ab', 4))\n"
3721
+ "b'ab\\ x00\\ x00'\n"
3722
+ ">>> bytes(create_string_buffer(b'abcdef', 2))\n"
3723
+ "Traceback (most recent call last):\n"
3724
+ " ...\n"
3725
+ "ValueError: byte string too long"
3714
3726
3715
3727
#: ../../library/ctypes.rst:1981
3716
3728
msgid ""
@@ -3731,6 +3743,8 @@ msgid ""
3731
3743
"The function takes the same arguments as :func:`~create_string_buffer` "
3732
3744
"except *init* must be a string and *size* counts :class:`c_wchar`."
3733
3745
msgstr ""
3746
+ "此函数接受与 :func:`~create_string_buffer` 相同的参数但是 *init* 必须是一个字符串而 *size* 是对 "
3747
+ ":class:`c_wchar` 计数。"
3734
3748
3735
3749
#: ../../library/ctypes.rst:1993
3736
3750
msgid ""
0 commit comments