Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92dac29

Browse files
[po] auto sync
1 parent 24ad263 commit 92dac29

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "89.78%", "updated_at": "2023-08-13T22:56:24Z"}
1+
{"translation": "89.80%", "updated_at": "2023-08-13T23:56:48Z"}

library/ctypes.po

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,10 @@ msgid ""
983983
"array instances instead of pointer types. So, for ``POINTER(c_int)``, "
984984
"ctypes accepts an array of c_int::"
985985
msgstr ""
986+
"通常,ctypes 会进行严格的类型检查。 这意味着,如果在函数的 :attr:`~_FuncPtr.argtypes` 列表中有 "
987+
"``POINTER(c_int)`` 或在结构体定义中将其用作成员字段的类型,则只接受完全相同类型的实例。 此规则也有一些例外情况,在这些情况下 "
988+
"ctypes 可以接受其他对象。 例如,你可以传入兼容的数组实例而不是指针类型。 因此,对于 ``POINTER(c_int)``,ctypes "
989+
"接受一个 c_int 数组::"
986990

987991
#: ../../library/ctypes.rst:878
988992
msgid ""
@@ -992,6 +996,9 @@ msgid ""
992996
"ctypes will apply the required :func:`byref` conversion in this case "
993997
"automatically."
994998
msgstr ""
999+
"此外,如果函数参数在 :attr:`_FuncPtr.argtypes` 中明确声明为指针类型 (如 "
1000+
"``POINTER(c_int)``),则可以向函数传递所指向的类型的对象 (在本例中为 ``c_int``)。 在这种情况下,ctypes "
1001+
"将自动应用所需的 :func:`byref` 转换。"
9951002

9961003
#: ../../library/ctypes.rst:883
9971004
msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::"
@@ -1552,6 +1559,9 @@ msgid ""
15521559
":c:func:`!dlopen` or :c:func:`LoadLibrary` function is used to load the "
15531560
"library into the process, and to get a handle to it."
15541561
msgstr ""
1562+
"所有这些类都可以通过附带至少一个参数,即共享库的路径名来实例化。 如果你有一个指向已加载共享库的现有句柄,则可以将其作为名为 ``handle`` "
1563+
"的参数传入,否则将使用底层的平台 :c:func:`!dlopen` 或 :c:func:`LoadLibrary` "
1564+
"函数将库加载到进程中,并获取其句柄。"
15551565

15561566
#: ../../library/ctypes.rst:1446
15571567
msgid ""
@@ -1665,6 +1675,8 @@ msgid ""
16651675
"calling the :meth:`~LibraryLoader.LoadLibrary` method, or by retrieving the "
16661676
"library as attribute of the loader instance."
16671677
msgstr ""
1678+
"共享库也可以通过使用一个预制对象来加载,这种对象是 :class:`LibraryLoader` 类的实例,具体做法是调用 "
1679+
":meth:`~LibraryLoader.LoadLibrary` 方法,或是将库作为加载器实例的属性来提取。"
16681680

16691681
#: ../../library/ctypes.rst:1533
16701682
msgid ""
@@ -1842,6 +1854,9 @@ msgid ""
18421854
":attr:`argtypes` tuple will convert a string passed as argument into a bytes"
18431855
" object using ctypes conversion rules."
18441856
msgstr ""
1857+
"当调用外部函数时,每个实际参数都会被传给 :attr:`argtypes` 元组中条目的 :meth:`~_CData.from_param` "
1858+
"类方法,该方法允许将实际参数适配为此外部函数所接受的对象。 例如,:attr:`argtypes` 元组中的 :class:`c_char_p` "
1859+
"条目将使用 ctypes 转换规则把作为参数传入的字符串转换为字节串对象。"
18451860

18461861
#: ../../library/ctypes.rst:1650
18471862
msgid ""
@@ -1850,6 +1865,8 @@ msgid ""
18501865
" value usable as argument (integer, string, ctypes instance). This allows "
18511866
"defining adapters that can adapt custom objects as function parameters."
18521867
msgstr ""
1868+
"新特性:现在可以在 argtypes 中放入非 ctypes 类型的条目,但每个条目必须具有 :meth:`~_CData.from_param` "
1869+
"方法用于返回一个可作为参数的值(整数、字符串、ctypes 实例)。 这样就允许定义可将将自定义对象适配为函数参数的适配器。"
18531870

18541871
#: ../../library/ctypes.rst:1657
18551872
msgid ""
@@ -2014,6 +2031,8 @@ msgid ""
20142031
"COM interface as first argument, in addition to those parameters that are "
20152032
"specified in the :attr:`~_FuncPtr.argtypes` tuple."
20162033
msgstr ""
2034+
"COM 方法使用特殊的调用约定:除了在 :attr:`~_FuncPtr.argtypes` 元组中指定的参数外,它们还需要一个指向 COM "
2035+
"接口的指针作为第一个参数。"
20172036

20182037
#: ../../library/ctypes.rst:1777
20192038
msgid ""
@@ -2025,7 +2044,7 @@ msgstr "可选的 *paramflags* 形参会创建相比上述特性具有更多功
20252044
msgid ""
20262045
"*paramflags* must be a tuple of the same length as "
20272046
":attr:`~_FuncPtr.argtypes`."
2028-
msgstr ""
2047+
msgstr "*paramflags* 必须为一个与 :attr:`~_FuncPtr.argtypes` 长度相同的元组。"
20292048

20302049
#: ../../library/ctypes.rst:1782
20312050
msgid ""
@@ -2538,6 +2557,8 @@ msgid ""
25382557
"foreign function's :attr:`~_FuncPtr.argtypes` tuple; it must return an "
25392558
"object that can be used as a function call parameter."
25402559
msgstr ""
2560+
"此方法会将 *obj* 适配为一个 ctypes 类型。 当该类型出现在外部函数的 :attr:`~_FuncPtr.argtypes` "
2561+
"元组中时它将会被调用并传入在该外部函数中使用的实际对象;它必须返回一个可被用作函数调用参数的对象。"
25412562

25422563
#: ../../library/ctypes.rst:2165
25432564
msgid ""

0 commit comments

Comments
 (0)