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

Skip to content

Commit 8ba49ca

Browse files
[po] auto sync
1 parent b36921a commit 8ba49ca

12 files changed

Lines changed: 1289 additions & 1196 deletions

File tree

c-api/call.po

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ msgid ""
5353
"code. *args* must be non-NULL (use an empty tuple if there are no arguments)"
5454
" but *kwargs* may be *NULL* if there are no keyword arguments."
5555
msgstr ""
56+
"一个调用是用一个元组表示位置参数,用一个dict表示关键字参数,类似于Python代码中的``callable(*args, "
57+
"**kwargs)``。*args*必须是非空的(如果没有参数,会使用一个空元组),但如果没有关键字参数,*kwargs*可以是*NULL*。"
5658

5759
#: ../../c-api/call.rst:25
5860
msgid ""
5961
"This convention is not only used by *tp_call*: "
6062
":c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_init` also "
6163
"pass arguments this way."
6264
msgstr ""
65+
"这个约定不仅被*tp_call*使用: :c:member:`~PyTypeObject.tp_new` 和 "
66+
":c:member:`~PyTypeObject.tp_init` 也这样传递参数。"
6367

6468
#: ../../c-api/call.rst:29
6569
msgid ""
@@ -88,6 +92,10 @@ msgid ""
8892
" achieve this is by setting :c:member:`~PyTypeObject.tp_call` to "
8993
":c:func:`PyVectorcall_Call`. This bears repeating:"
9094
msgstr ""
95+
"作为经验法则,如果可调用程序支持 vectorcall,CPython 会更倾向于内联调用。 然而,这并不是一个硬性规定。 此外,一些第三方扩展直接使用"
96+
" *tp_call* (而不是使用 :c:func:`PyObject_Call`)。 因此,一个支持 vectorcall 的类也必须实现 "
97+
":c:member:`~PyTypeObject.tp_call`。 此外,无论使用哪种协议,可调对象的行为都必须是相同的。 推荐的方法是将 "
98+
":c:member:`~PyTypeObject.tp_call` 设置为 :c:func:`PyVectorcall_Call`。值得一提的是:"
9199

92100
#: ../../c-api/call.rst:57
93101
msgid ""
@@ -103,6 +111,8 @@ msgid ""
103111
"args tuple and kwargs dict anyway, then there is no point in implementing "
104112
"vectorcall."
105113
msgstr ""
114+
"如果一个类的vectorcall比*tp_call*慢,就不应该实现vectorcall。例如,如果被调用者需要将参数转换为args 元组和kwargs"
115+
" dict,那么实现vectorcall就没有意义。"
106116

107117
#: ../../c-api/call.rst:65
108118
msgid ""
@@ -112,6 +122,9 @@ msgid ""
112122
"object structure where a *vectorcallfunc* appears. This is a pointer to a "
113123
"function with the following signature:"
114124
msgstr ""
125+
"类可以通过启用 :const:`Py_TPFLAGS_HAVE_VECTORCALL` 标志并将 "
126+
":c:member:`~PyTypeObject.tp_vectorcall_offset` 设置为对象结构中的 *vectorcallfunc* 的 "
127+
"offset 来实现 vectorcall 协议。这是一个指向具有以下签名的函数的指针:"
115128

116129
#: ../../c-api/call.rst:73
117130
msgid "*callable* is the object being called."
@@ -137,6 +150,8 @@ msgid ""
137150
":const:`PY_VECTORCALL_ARGUMENTS_OFFSET` flag. To get the actual number of "
138151
"positional arguments from *nargsf*, use :c:func:`PyVectorcall_NARGS`."
139152
msgstr ""
153+
":const:`PY_VECTORCALL_ARGUMENTS_OFFSET` 标志。 要从 *nargsf* 获得实际的位置参数数,请使用 "
154+
":c:func:`PyVectorcall_NARGS`。"
140155

141156
#: ../../c-api/call.rst:85
142157
msgid "*kwnames* is a tuple containing the names of the keyword arguments;"
@@ -148,6 +163,8 @@ msgid ""
148163
"(instances of ``str`` or a subclass) and they must be unique. If there are "
149164
"no keyword arguments, then *kwnames* can instead be *NULL*."
150165
msgstr ""
166+
"换句话说,就是 kwargs 字典的键。 这些名字必须是字符串 (``str`` 或其子类的实例),并且它们必须是唯一的。 如果没有关键字参数,那么 "
167+
"*kwnames* 可以用 *NULL* 代替。"
151168

152169
#: ../../c-api/call.rst:89
153170
msgid ""
@@ -177,6 +194,8 @@ msgid ""
177194
"call>` function as with any other callable. :c:func:`PyObject_Vectorcall` "
178195
"will usually be most efficient."
179196
msgstr ""
197+
"要调用一个实现了 vectorcall 的对象,请使用某个 :ref:`call API<capi-call>` 函数,就像其他可调对象一样。 "
198+
":c:func:`PyObject_Vectorcall` 通常是最有效的。"
180199

181200
#: ../../c-api/call.rst:109
182201
msgid ""
@@ -218,7 +237,7 @@ msgstr "Vectorcall 支持 API"
218237
msgid ""
219238
"Given a vectorcall *nargsf* argument, return the actual number of arguments."
220239
" Currently equivalent to::"
221-
msgstr ""
240+
msgstr "给定一个 vectorcall *nargsf* 实参,返回参数的实际数量。 目前等同于::"
222241

223242
#: ../../c-api/call.rst:144
224243
msgid ""
@@ -239,6 +258,7 @@ msgid ""
239258
"Otherwise, return the vectorcall function pointer stored in *op*. This "
240259
"function never raises an exception."
241260
msgstr ""
261+
"如果*op*不支持vectorcall协议(要么是因为类型不支持,要么是因为具体实例不支持),返回*NULL*。否则,返回存储在*op*中的vectorcall函数指针。这个函数从不触发异常。"
242262

243263
#: ../../c-api/call.rst:158
244264
msgid ""
@@ -250,7 +270,7 @@ msgstr ""
250270
msgid ""
251271
"Call *callable*'s :c:type:`vectorcallfunc` with positional and keyword "
252272
"arguments given in a tuple and dict, respectively."
253-
msgstr ""
273+
msgstr "调用*可调对象*的 :c:type:`vectorcallfunc`,其位置参数和关键字参数分别以元组和dict形式给出。"
254274

255275
#: ../../c-api/call.rst:170
256276
msgid ""

0 commit comments

Comments
 (0)