@@ -13,7 +13,7 @@ msgid ""
1313msgstr ""
1414"Project-Id-Version : Python 3.12\n "
1515"Report-Msgid-Bugs-To : \n "
16- "POT-Creation-Date : 2024-11-29 14:50+0000\n "
16+ "POT-Creation-Date : 2024-12-20 14:50+0000\n "
1717"PO-Revision-Date : 2024-05-11 00:33+0000\n "
1818"Last-Translator : Rafael Fontenelle <rffontenelle@gmail.com>, 2024\n "
1919"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -875,7 +875,7 @@ msgstr ""
875875msgid ""
876876"On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes`"
877877" attribute for the regular, non-variadic, function arguments:"
878- msgstr ""
878+ msgstr "在这些平台上要求为常规、非可变函数参数指定 :attr:`~_CFuncPtr.argtypes` 属性: "
879879
880880#: ../../library/ctypes.rst:389
881881msgid "libc.printf.argtypes = [ctypes.c_char_p]"
@@ -885,7 +885,7 @@ msgstr "libc.printf.argtypes = [ctypes.c_char_p]"
885885msgid ""
886886"Because specifying the attribute does not inhibit portability it is advised "
887887"to always specify :attr:`~_CFuncPtr.argtypes` for all variadic functions."
888- msgstr ""
888+ msgstr "因为指定该属性不会影响可移植性所以建议总是为所有可变函数指定 :attr:`~_CFuncPtr.argtypes`。 "
889889
890890#: ../../library/ctypes.rst:400
891891msgid "Calling functions with your own custom data types"
@@ -942,7 +942,7 @@ msgstr "指定必选参数的类型(函数原型)"
942942msgid ""
943943"It is possible to specify the required argument types of functions exported "
944944"from DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute."
945- msgstr ""
945+ msgstr "可以通过设置 :attr:`~_CFuncPtr.argtypes` 属性来指定从 DLL 导出函数的必选参数类型。 "
946946
947947#: ../../library/ctypes.rst:431
948948msgid ""
@@ -952,6 +952,8 @@ msgid ""
952952"format string, on the other hand this is quite handy to experiment with this"
953953" feature)::"
954954msgstr ""
955+ ":attr:`~_CFuncPtr.argtypes` 必须是一个 C 数据类型的序列(这里 :func:`!printf` "
956+ "函数可能不是一个好例子,因为它会根据格式字符串的不同接受可变数量和不同类型的形参,但另一方面这对尝试此功能来说也很方便)::"
955957
956958#: ../../library/ctypes.rst:436
957959msgid ""
@@ -999,6 +1001,11 @@ msgid ""
9991001"string, bytes, a :mod:`ctypes` instance, or an object with an "
10001002":attr:`!_as_parameter_` attribute."
10011003msgstr ""
1004+ "如果你定义了自己的类并将其传递给函数调用,则你必须为它们实现 :meth:`~_CData.from_param` 类方法才能够在 "
1005+ ":attr:`~_CFuncPtr.argtypes` 序列中使用它们。 :meth:`~_CData.from_param` "
1006+ "类方法接受传递给函数调用的 Python 对象,它应该进行类型检查或者其他必要的操作以确保这个对象是可接受的,然后返回对象本身、它的 "
1007+ ":attr:`!_as_parameter_` 属性,或在此情况下作为 C 函数参数传入的任何东西。 "
1008+ "同样,结果应该是整数、字符串、字节串、:mod:`ctypes` 实例或是具有 :attr:`!_as_parameter_` 属性的对象。"
10021009
10031010#: ../../library/ctypes.rst:468
10041011msgid "Return types"
@@ -1010,6 +1017,8 @@ msgid ""
10101017"return types can be specified by setting the :attr:`~_CFuncPtr.restype` "
10111018"attribute of the function object."
10121019msgstr ""
1020+ "在默认情况下都会假定函数返回 C :c:expr:`int` 类型。 其他返回类型可通过设置函数对象的 setting the "
1021+ ":attr:`~_CFuncPtr.restype` 属性来指定。"
10131022
10141023#: ../../library/ctypes.rst:482
10151024msgid ""
@@ -1081,6 +1090,8 @@ msgid ""
10811090"the :attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be "
10821091"converted from a single character Python bytes object into a C char:"
10831092msgstr ""
1093+ "如果你想要避免上面的 :func:`ord(\" x\" ) <ord>` 调用,你可以设置 :attr:`~_CFuncPtr.argtypes` "
1094+ "属性,第二个参数将从单字符 Python 字节串对象转换为 C char:"
10841095
10851096#: ../../library/ctypes.rst:514
10861097msgid ""
@@ -1119,6 +1130,8 @@ msgid ""
11191130"result of your function call. This is useful to check for error return "
11201131"values and automatically raise an exception::"
11211132msgstr ""
1133+ "如果外部函数返回一个整数,你也可以使用一个 Python 可调用对象(例如函数或类)作为 :attr:`~_CFuncPtr.restype` 属性。 "
1134+ "该可调用对象被调用时将附带 C 函数返回的 *整数*,其调用结果将被用作函数调用的结果值。 这对于检查错误返回值并自动引发异常来说很有用处::"
11221135
11231136#: ../../library/ctypes.rst:535
11241137msgid ""
@@ -1171,7 +1184,7 @@ msgid ""
11711184"Please note that a much more powerful error checking mechanism is available "
11721185"through the :attr:`~_CFuncPtr.errcheck` attribute; see the reference manual "
11731186"for details."
1174- msgstr ""
1187+ msgstr "请注意通过 :attr:`~_CFuncPtr.errcheck` 属性可提供更强大的错误检查机制;详情见参考手册。 "
11751188
11761189#: ../../library/ctypes.rst:565
11771190msgid "Passing pointers (or: passing parameters by reference)"
@@ -4241,7 +4254,7 @@ msgstr ""
42414254msgid ""
42424255"Represents a :c:type:`!HRESULT` value, which contains success or error "
42434256"information for a function or method call."
4244- msgstr ""
4257+ msgstr "代表一个 :c:type:`!HRESULT` 值,它包含某个函数或方法调用的成功或错误信息。 "
42454258
42464259#: ../../library/ctypes.rst:2478
42474260msgid ""
0 commit comments