@@ -13,7 +13,7 @@ msgid ""
13
13
msgstr ""
14
14
"Project-Id-Version : Python 3.12\n "
15
15
"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 "
17
17
"PO-Revision-Date : 2024-05-11 00:33+0000\n "
18
18
"
Last-Translator :
Rafael Fontenelle <[email protected] >, 2024\n "
19
19
"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -875,7 +875,7 @@ msgstr ""
875
875
msgid ""
876
876
"On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes`"
877
877
" attribute for the regular, non-variadic, function arguments:"
878
- msgstr ""
878
+ msgstr "在这些平台上要求为常规、非可变函数参数指定 :attr:`~_CFuncPtr.argtypes` 属性: "
879
879
880
880
#: ../../library/ctypes.rst:389
881
881
msgid "libc.printf.argtypes = [ctypes.c_char_p]"
@@ -885,7 +885,7 @@ msgstr "libc.printf.argtypes = [ctypes.c_char_p]"
885
885
msgid ""
886
886
"Because specifying the attribute does not inhibit portability it is advised "
887
887
"to always specify :attr:`~_CFuncPtr.argtypes` for all variadic functions."
888
- msgstr ""
888
+ msgstr "因为指定该属性不会影响可移植性所以建议总是为所有可变函数指定 :attr:`~_CFuncPtr.argtypes`。 "
889
889
890
890
#: ../../library/ctypes.rst:400
891
891
msgid "Calling functions with your own custom data types"
@@ -942,7 +942,7 @@ msgstr "指定必选参数的类型(函数原型)"
942
942
msgid ""
943
943
"It is possible to specify the required argument types of functions exported "
944
944
"from DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute."
945
- msgstr ""
945
+ msgstr "可以通过设置 :attr:`~_CFuncPtr.argtypes` 属性来指定从 DLL 导出函数的必选参数类型。 "
946
946
947
947
#: ../../library/ctypes.rst:431
948
948
msgid ""
@@ -952,6 +952,8 @@ msgid ""
952
952
"format string, on the other hand this is quite handy to experiment with this"
953
953
" feature)::"
954
954
msgstr ""
955
+ ":attr:`~_CFuncPtr.argtypes` 必须是一个 C 数据类型的序列(这里 :func:`!printf` "
956
+ "函数可能不是一个好例子,因为它会根据格式字符串的不同接受可变数量和不同类型的形参,但另一方面这对尝试此功能来说也很方便)::"
955
957
956
958
#: ../../library/ctypes.rst:436
957
959
msgid ""
@@ -999,6 +1001,11 @@ msgid ""
999
1001
"string, bytes, a :mod:`ctypes` instance, or an object with an "
1000
1002
":attr:`!_as_parameter_` attribute."
1001
1003
msgstr ""
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_` 属性的对象。"
1002
1009
1003
1010
#: ../../library/ctypes.rst:468
1004
1011
msgid "Return types"
@@ -1010,6 +1017,8 @@ msgid ""
1010
1017
"return types can be specified by setting the :attr:`~_CFuncPtr.restype` "
1011
1018
"attribute of the function object."
1012
1019
msgstr ""
1020
+ "在默认情况下都会假定函数返回 C :c:expr:`int` 类型。 其他返回类型可通过设置函数对象的 setting the "
1021
+ ":attr:`~_CFuncPtr.restype` 属性来指定。"
1013
1022
1014
1023
#: ../../library/ctypes.rst:482
1015
1024
msgid ""
@@ -1081,6 +1090,8 @@ msgid ""
1081
1090
"the :attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be "
1082
1091
"converted from a single character Python bytes object into a C char:"
1083
1092
msgstr ""
1093
+ "如果你想要避免上面的 :func:`ord(\" x\" ) <ord>` 调用,你可以设置 :attr:`~_CFuncPtr.argtypes` "
1094
+ "属性,第二个参数将从单字符 Python 字节串对象转换为 C char:"
1084
1095
1085
1096
#: ../../library/ctypes.rst:514
1086
1097
msgid ""
@@ -1119,6 +1130,8 @@ msgid ""
1119
1130
"result of your function call. This is useful to check for error return "
1120
1131
"values and automatically raise an exception::"
1121
1132
msgstr ""
1133
+ "如果外部函数返回一个整数,你也可以使用一个 Python 可调用对象(例如函数或类)作为 :attr:`~_CFuncPtr.restype` 属性。 "
1134
+ "该可调用对象被调用时将附带 C 函数返回的 *整数*,其调用结果将被用作函数调用的结果值。 这对于检查错误返回值并自动引发异常来说很有用处::"
1122
1135
1123
1136
#: ../../library/ctypes.rst:535
1124
1137
msgid ""
@@ -1171,7 +1184,7 @@ msgid ""
1171
1184
"Please note that a much more powerful error checking mechanism is available "
1172
1185
"through the :attr:`~_CFuncPtr.errcheck` attribute; see the reference manual "
1173
1186
"for details."
1174
- msgstr ""
1187
+ msgstr "请注意通过 :attr:`~_CFuncPtr.errcheck` 属性可提供更强大的错误检查机制;详情见参考手册。 "
1175
1188
1176
1189
#: ../../library/ctypes.rst:565
1177
1190
msgid "Passing pointers (or: passing parameters by reference)"
@@ -4241,7 +4254,7 @@ msgstr ""
4241
4254
msgid ""
4242
4255
"Represents a :c:type:`!HRESULT` value, which contains success or error "
4243
4256
"information for a function or method call."
4244
- msgstr ""
4257
+ msgstr "代表一个 :c:type:`!HRESULT` 值,它包含某个函数或方法调用的成功或错误信息。 "
4245
4258
4246
4259
#: ../../library/ctypes.rst:2478
4247
4260
msgid ""
0 commit comments