Skip to content

Commit 8fa8393

Browse files
sync with cpython 8eeb800f
1 parent 23d45ee commit 8fa8393

File tree

5 files changed

+770
-579
lines changed

5 files changed

+770
-579
lines changed

c-api/list.po

Lines changed: 93 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ msgid ""
99
msgstr ""
1010
"Project-Id-Version: Python 3.14\n"
1111
"Report-Msgid-Bugs-To: \n"
12-
"POT-Creation-Date: 2024-09-23 07:52+0800\n"
12+
"POT-Creation-Date: 2026-03-19 00:23+0000\n"
1313
"PO-Revision-Date: 2025-11-25 22:16+0800\n"
1414
"Last-Translator: Yorkxe <karta25768@gmail.com>\n"
1515
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -34,8 +34,8 @@ msgid ""
3434
"This instance of :c:type:`PyTypeObject` represents the Python list type. "
3535
"This is the same object as :class:`list` in the Python layer."
3636
msgstr ""
37-
"此 :c:type:`PyTypeObject` 實例表示 Python 的 list 型別。這與 Python 層中"
38-
"的 :class:`list` 是同一個物件。"
37+
"此 :c:type:`PyTypeObject` 實例表示 Python 的 list 型別。這與 Python 層中的 :"
38+
"class:`list` 是同一個物件。"
3939

4040
#: ../../c-api/list.rst:24
4141
msgid ""
@@ -60,18 +60,18 @@ msgstr "成功時回傳長度為 *len* 的新串列,失敗時回傳 ``NULL``
6060
#: ../../c-api/list.rst:40
6161
msgid ""
6262
"If *len* is greater than zero, the returned list object's items are set to "
63-
"``NULL``. Thus you cannot use abstract API functions such "
64-
"as :c:func:`PySequence_SetItem` or expose the object to Python code before "
65-
"setting all items to a real object with :c:func:`PyList_SetItem` "
66-
"or :c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before the "
67-
"list is fully initialized: :c:func:`PyList_SetItem()` "
68-
"and :c:func:`PyList_SET_ITEM()`."
63+
"``NULL``. Thus you cannot use abstract API functions such as :c:func:"
64+
"`PySequence_SetItem` or expose the object to Python code before setting all "
65+
"items to a real object with :c:func:`PyList_SetItem` or :c:func:"
66+
"`PyList_SET_ITEM()`. The following APIs are safe APIs before the list is "
67+
"fully initialized: :c:func:`PyList_SetItem()` and :c:func:"
68+
"`PyList_SET_ITEM()`."
6969
msgstr ""
70-
"如果 *len* 大於零,則回傳的串列物件之項目將被設定為 ``NULL``。因此,在使"
71-
"用 :c:func:`PyList_SetItem` 或 :c:func:`PyList_SET_ITEM()` 來將所有項目設定為"
72-
"一個真實物件前,你無法使用像是 :c:func:`PySequence_SetItem` 的抽象 API 函式,"
73-
"也不能將物件暴露 (expose) 給 Python 程式碼。以下 API 在串列完全初始化之前是安"
74-
"全的::c:func:`PyList_SetItem()` 和 :c:func:`PyList_SET_ITEM()`。"
70+
"如果 *len* 大於零,則回傳的串列物件之項目將被設定為 ``NULL``。因此,在使用 :"
71+
"c:func:`PyList_SetItem` 或 :c:func:`PyList_SET_ITEM()` 來將所有項目設定為一個"
72+
"真實物件前,你無法使用像是 :c:func:`PySequence_SetItem` 的抽象 API 函式,也不"
73+
"能將物件暴露 (expose) 給 Python 程式碼。以下 API 在串列完全初始化之前是安全"
74+
"::c:func:`PyList_SetItem()` 和 :c:func:`PyList_SET_ITEM()`。"
7575

7676
#: ../../c-api/list.rst:53
7777
msgid ""
@@ -99,14 +99,21 @@ msgid ""
9999
"Like :c:func:`PyList_GetItemRef`, but returns a :term:`borrowed reference` "
100100
"instead of a :term:`strong reference`."
101101
msgstr ""
102-
"與 :c:func:`PyList_GetItemRef` 類似,但回傳一個 :term:`borrowed reference` "
103-
"而非一個 :term:`strong reference`。"
102+
"與 :c:func:`PyList_GetItemRef` 類似,但回傳一個 :term:`borrowed reference` "
103+
"非一個 :term:`strong reference`。"
104104

105-
#: ../../c-api/list.rst:80
105+
#: ../../c-api/list.rst:79 ../../c-api/list.rst:91
106+
msgid ""
107+
"In the :term:`free-threaded build`, the returned :term:`borrowed reference` "
108+
"may become invalid if another thread modifies the list concurrently. Prefer :"
109+
"c:func:`PyList_GetItemRef`, which returns a :term:`strong reference`."
110+
msgstr ""
111+
112+
#: ../../c-api/list.rst:87
106113
msgid "Similar to :c:func:`PyList_GetItem`, but without error checking."
107114
msgstr "與 :c:func:`PyList_GetItem` 類似,但沒有錯誤檢查。"
108115

109-
#: ../../c-api/list.rst:85
116+
#: ../../c-api/list.rst:99
110117
msgid ""
111118
"Set the item at index *index* in list to *item*. Return ``0`` on success. "
112119
"If *index* is out of bounds, return ``-1`` and set an :exc:`IndexError` "
@@ -115,42 +122,49 @@ msgstr ""
115122
"將串列中索引 *index* 處的項目設定為 *item*。成功時回傳 ``0``。如果 *index* 超"
116123
"出邊界範圍則回傳 ``-1`` 並設定一個 :exc:`IndexError` 例外。"
117124

118-
#: ../../c-api/list.rst:91
125+
#: ../../c-api/list.rst:105
119126
msgid ""
120127
"This function \"steals\" a reference to *item* and discards a reference to "
121128
"an item already in the list at the affected position."
122-
msgstr "此函式「竊取」對 *item* 的參照,並丟棄對串列中受影響位置上已存在項目的參照。"
129+
msgstr ""
130+
"此函式「竊取」對 *item* 的參照,並丟棄對串列中受影響位置上已存在項目的參照。"
123131

124-
#: ../../c-api/list.rst:97
132+
#: ../../c-api/list.rst:111
125133
msgid ""
126134
"Macro form of :c:func:`PyList_SetItem` without error checking. This is "
127135
"normally only used to fill in new lists where there is no previous content."
128136
msgstr ""
129137
":c:func:`PyList_SetItem` 的巨集形式,沒有錯誤檢查。這通常僅用於填充沒有已存在"
130138
"內容的新串列。"
131139

132-
#: ../../c-api/list.rst:100
140+
#: ../../c-api/list.rst:114
133141
msgid ""
134-
"Bounds checking is performed as an assertion if Python is built "
135-
"in :ref:`debug mode <debug-build>` or :option:`with assertions <--with-"
136-
"assertions>`."
142+
"Bounds checking is performed as an assertion if Python is built in :ref:"
143+
"`debug mode <debug-build>` or :option:`with assertions <--with-assertions>`."
137144
msgstr ""
138-
"如果 Python 是以\\ :ref:`偵錯模式 <debug-build>`\\ 或 "
139-
":option:`with assertions <--with-assertions>` 建置,則會進行作為"
140-
"斷言(asserting)的邊界檢查。"
145+
"如果 Python 是以\\ :ref:`偵錯模式 <debug-build>`\\:option:`with "
146+
"assertions <--with-assertions>` 建置,則會進行作為斷言(asserting)的邊界檢"
147+
"。"
141148

142-
#: ../../c-api/list.rst:106
149+
#: ../../c-api/list.rst:120
143150
msgid ""
144-
"This macro \"steals\" a reference to *item*, and, "
145-
"unlike :c:func:`PyList_SetItem`, does *not* discard a reference to any item "
146-
"that is being replaced; any reference in *list* at position *i* will be "
147-
"leaked."
151+
"This macro \"steals\" a reference to *item*, and, unlike :c:func:"
152+
"`PyList_SetItem`, does *not* discard a reference to any item that is being "
153+
"replaced; any reference in *list* at position *i* will be leaked."
148154
msgstr ""
149155
"該巨集「竊取」對 *item* 的參照,並且與 :c:func:`PyList_SetItem` 不同的是,它"
150156
"\\ *不會*\\ 丟棄對任意被替換項目的參照;*list* 中位置 *i* 的任何參照都將被洩"
151157
"漏 (leak)。"
152158

153-
#: ../../c-api/list.rst:114
159+
#: ../../c-api/list.rst:127
160+
msgid ""
161+
"In the :term:`free-threaded build`, this macro has no internal "
162+
"synchronization. It is normally only used to fill in new lists where no "
163+
"other thread has a reference to the list. If the list may be shared, use :c:"
164+
"func:`PyList_SetItem` instead, which uses a :term:`per-object lock`."
165+
msgstr ""
166+
167+
#: ../../c-api/list.rst:136
154168
msgid ""
155169
"Insert the item *item* into list *list* in front of index *index*. Return "
156170
"``0`` if successful; return ``-1`` and set an exception if unsuccessful. "
@@ -160,7 +174,7 @@ msgstr ""
160174
"``0``;如果失敗則回傳 ``-1`` 並設定例外。類似於 ``list.insert(index, "
161175
"item)``。"
162176

163-
#: ../../c-api/list.rst:121
177+
#: ../../c-api/list.rst:143
164178
msgid ""
165179
"Append the object *item* at the end of list *list*. Return ``0`` if "
166180
"successful; return ``-1`` and set an exception if unsuccessful. Analogous "
@@ -169,7 +183,7 @@ msgstr ""
169183
"將物件 *item* 附加到串列 *list* 的最後面。如果成功則回傳 ``0``;如果不成功,"
170184
"則回傳 ``-1`` 並設定例外。類似於 ``list.append(item)``。"
171185

172-
#: ../../c-api/list.rst:128
186+
#: ../../c-api/list.rst:150
173187
msgid ""
174188
"Return a list of the objects in *list* containing the objects *between* "
175189
"*low* and *high*. Return ``NULL`` and set an exception if unsuccessful. "
@@ -180,7 +194,7 @@ msgstr ""
180194
"成功則回傳 ``NULL`` 並設定例外。類似於 ``list[low:high]``。不支援從串列尾末開"
181195
"始索引。"
182196

183-
#: ../../c-api/list.rst:135
197+
#: ../../c-api/list.rst:157
184198
msgid ""
185199
"Set the slice of *list* between *low* and *high* to the contents of "
186200
"*itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may "
@@ -193,56 +207,82 @@ msgstr ""
193207
"(切片刪除)。成功時回傳 ``0``,失敗時則回傳 ``-1``。不支援從串列尾末開始索"
194208
"引。"
195209

196-
#: ../../c-api/list.rst:144
210+
#: ../../c-api/list.rst:165
211+
msgid ""
212+
"In the :term:`free-threaded build`, when *itemlist* is a :class:`list`, both "
213+
"*list* and *itemlist* are locked for the duration of the operation. For "
214+
"other iterables (or ``NULL``), only *list* is locked."
215+
msgstr ""
216+
217+
#: ../../c-api/list.rst:172
197218
msgid ""
198219
"Extend *list* with the contents of *iterable*. This is the same as "
199220
"``PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` and "
200221
"analogous to ``list.extend(iterable)`` or ``list += iterable``."
201222
msgstr ""
202223
"以 *iterable* 中的內容擴展 *list*。這與 ``PyList_SetSlice(list, "
203-
"PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` 相同,類似於 "
204-
"``list.extend(iterable)`` 或 ``list += iterable``。"
224+
"PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` 相同,類似於 ``list."
225+
"extend(iterable)`` 或 ``list += iterable``。"
205226

206-
#: ../../c-api/list.rst:148
227+
#: ../../c-api/list.rst:176
207228
msgid ""
208229
"Raise an exception and return ``-1`` if *list* is not a :class:`list` "
209230
"object. Return 0 on success."
210231
msgstr ""
211232
"引發一個例外並回傳 ``-1`` 如果 *list* 不是一個 :class:`list` 物件。如果成功回"
212233
"傳 0。"
213234

214-
#: ../../c-api/list.rst:156
235+
#: ../../c-api/list.rst:183
236+
msgid ""
237+
"In the :term:`free-threaded build`, when *iterable* is a :class:`list`, :"
238+
"class:`set`, :class:`dict`, or dict view, both *list* and *iterable* (or its "
239+
"underlying dict) are locked for the duration of the operation. For other "
240+
"iterables, only *list* is locked; *iterable* may be concurrently modified by "
241+
"another thread."
242+
msgstr ""
243+
244+
#: ../../c-api/list.rst:192
215245
msgid ""
216246
"Remove all items from *list*. This is the same as ``PyList_SetSlice(list, "
217247
"0, PY_SSIZE_T_MAX, NULL)`` and analogous to ``list.clear()`` or ``del "
218248
"list[:]``."
219-
msgstr "移除 *list* 中的所有項目。這與 ``PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, "
249+
msgstr ""
250+
"移除 *list* 中的所有項目。這與 ``PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, "
220251
"NULL)`` 相同,類似於 ``list.clear()`` 或 ``del list[:]``。"
221252

222-
#: ../../c-api/list.rst:160
253+
#: ../../c-api/list.rst:196
223254
msgid ""
224255
"Raise an exception and return ``-1`` if *list* is not a :class:`list` "
225256
"object. Return 0 on success."
226-
msgstr "引發一個例外並回傳 ``-1`` 如果 *list* 不是一個 :class:`list` 物件。"
227-
"如果成功回傳 0。"
257+
msgstr ""
258+
"引發一個例外並回傳 ``-1`` 如果 *list* 不是一個 :class:`list` 物件。如果成功回"
259+
"傳 0。"
228260

229-
#: ../../c-api/list.rst:168
261+
#: ../../c-api/list.rst:204
230262
msgid ""
231263
"Sort the items of *list* in place. Return ``0`` on success, ``-1`` on "
232264
"failure. This is equivalent to ``list.sort()``."
233265
msgstr ""
234266
"對 *list* 的項目進行原地 (in place) 排序。成功時回傳 ``0``,失敗時回傳 "
235267
"``-1``。這相當於 ``list.sort()``。"
236268

237-
#: ../../c-api/list.rst:174
269+
#: ../../c-api/list.rst:209
270+
msgid ""
271+
"In the :term:`free-threaded build`, element comparison via :meth:`~object."
272+
"__lt__` can execute arbitrary Python code, during which the :term:`per-"
273+
"object lock` may be temporarily released. For built-in types (:class:`str`, :"
274+
"class:`int`, :class:`float`), the lock is not released during comparison."
275+
msgstr ""
276+
277+
#: ../../c-api/list.rst:218
238278
msgid ""
239279
"Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on "
240280
"failure. This is the equivalent of ``list.reverse()``."
241281
msgstr ""
242-
"原地反轉 *list* 的項目。成功時回傳 ``0``,失敗時回傳 ``-1``。這相當於 "
243-
"``list.reverse()``。"
282+
"原地反轉 *list* 的項目。成功時回傳 ``0``,失敗時回傳 ``-1``。這相當於 ``list."
283+
"reverse()``。"
244284

245-
#: ../../c-api/list.rst:182
285+
#: ../../c-api/list.rst:226
246286
msgid ""
247287
"Return a new tuple object containing the contents of *list*; equivalent to "
248288
"``tuple(list)``."
@@ -258,14 +298,14 @@ msgstr "object(物件)"
258298
msgid "list"
259299
msgstr "list(串列)"
260300

261-
#: ../../c-api/list.rst:51 ../../c-api/list.rst:180
301+
#: ../../c-api/list.rst:51 ../../c-api/list.rst:224
262302
msgid "built-in function"
263303
msgstr "built-in function(內建函式)"
264304

265305
#: ../../c-api/list.rst:51
266306
msgid "len"
267307
msgstr "len"
268308

269-
#: ../../c-api/list.rst:180
309+
#: ../../c-api/list.rst:224
270310
msgid "tuple"
271311
msgstr "tuple(元組)"

0 commit comments

Comments
 (0)