Skip to content

Commit 03424c0

Browse files
committed
Use :term:steal role consistently for the "steals a reference" idiom
Addresses review feedback on PR #1239: several c-api/*.po translations rendered the "steals a reference" idiom as plain-text 「竊取」 instead of linking it to the glossary via :term:`竊取 <steal>`, and one entry had stray spacing around the markup. Applies the same fix to every remaining occurrence across c-api/bytes.po, dict.po, exceptions.po, gen.po, list.po, module.po, sequence.po, tuple.po, and threads.po. Co-authored-by: Claude <noreply@anthropic.com>
1 parent a472e3f commit 03424c0

9 files changed

Lines changed: 44 additions & 39 deletions

File tree

c-api/bytes.po

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ msgid ""
313313
"appropriate exception will be set."
314314
msgstr ""
315315
"在 *\\*bytes* 中建立一個新的 bytes 物件,其內容為 *newpart* 附加到 *bytes* 之"
316-
"後的結果;呼叫者將擁有新的參照。*bytes* 舊值的參照將被「竊取」。如果無法建立"
317-
"新物件,*bytes* 的舊參照仍將被「竊取」,*\\*bytes* 的值將被設為 ``NULL``,並"
318-
"會設定適當的例外。"
316+
"後的結果;呼叫者將擁有新的參照。*bytes* 舊值的參照將被「:term:`竊取 "
317+
"<steal>`」。如果無法建立新物件,*bytes* 的舊參照仍將被「竊取」,*\\*bytes* "
318+
"值將被設為 ``NULL``,並會設定適當的例外。"
319319

320320
#: ../../c-api/bytes.rst:190 ../../c-api/bytes.rst:200
321321
msgid ""

c-api/dict.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ msgid ""
112112
msgstr ""
113113
"以 *key* 為鍵,將 *val* 插入至字典 *p* 中。*key* 必須是 :term:`可雜湊的 "
114114
"<hashable>`,否則將引發 :exc:`TypeError`。成功時回傳 ``0``,失敗時回傳 "
115-
"``-1``。此函式\\ *不會*\\竊取」對 *val* 的參照。"
115+
"``-1``。此函式\\ *不會*\\:term:`竊取 <steal>`」對 *val* 的參照。"
116116

117117
#: ../../c-api/dict.rst:103
118118
msgid ""

c-api/exceptions.po

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,8 @@ msgstr ""
543543
msgid ""
544544
"This call \":term:`steals <steal>`\" a reference to *exc*, which must be a "
545545
"valid exception."
546-
msgstr "此呼叫「竊取」對 *exc* 的參照,*exc* 必須為一個有效的例外。"
546+
msgstr ""
547+
"此呼叫「:term:`竊取 <steal>`」對 *exc* 的參照,*exc* 必須為一個有效的例外。"
547548

548549
#: ../../c-api/exceptions.rst:516
549550
msgid "Use :c:func:`PyErr_GetRaisedException` instead."
@@ -700,9 +701,9 @@ msgid ""
700701
"c:func:`PyErr_SetHandledException`."
701702
msgstr ""
702703
"設定例外資訊,如同從 ``sys.exc_info()`` 得知的資訊一般。這裡指的是一個 *已經"
703-
"被捕捉* 的例外,而不是剛被引發的例外。此函式「竊取」這些引數的參照。若要清除"
704-
"例外狀態,請為所有三個引數傳入 ``NULL``。此函式是為了向下相容而保留,建議改"
705-
" :c:func:`PyErr_SetHandledException`。"
704+
"被捕捉* 的例外,而不是剛被引發的例外。此函式「:term:`竊取 <steal>`」這些引數"
705+
"的參照。若要清除例外狀態,請為所有三個引數傳入 ``NULL``。此函式是為了向下相容"
706+
"而保留,建議改用 :c:func:`PyErr_SetHandledException`。"
706707

707708
#: ../../c-api/exceptions.rst:653
708709
msgid ""
@@ -720,7 +721,8 @@ msgid ""
720721
"three arguments."
721722
msgstr ""
722723
"引數 ``type`` 和 ``traceback`` 已不再使用,可以為 NULL。直譯器現在會從例外實"
723-
"例(引數 ``value``)中衍生出它們。此函式仍會「竊取」所有三個引數的參照。"
724+
"例(引數 ``value``)中衍生出它們。此函式仍會「:term:`竊取 <steal>`」所有三個"
725+
"引數的參照。"
724726

725727
#: ../../c-api/exceptions.rst:668
726728
msgid "Signal Handling"
@@ -940,7 +942,7 @@ msgid ""
940942
"instance. This \":term:`steals <steal>`\" a reference to *ctx*."
941943
msgstr ""
942944
"將與該例外關聯的情境設定為 *ctx*。使用 ``NULL`` 來清除它。這裡不會檢查型別以"
943-
"確保 *ctx* 是一個例外實例。此函式「竊取」對 *ctx* 的參照。"
945+
"確保 *ctx* 是一個例外實例。此函式「:term:`竊取 <steal>`」對 *ctx* 的參照。"
944946

945947
#: ../../c-api/exceptions.rst:861
946948
msgid ""
@@ -958,7 +960,8 @@ msgid ""
958960
"to *cause*."
959961
msgstr ""
960962
"將與該例外關聯的成因設定為 *cause*。使用 ``NULL`` 來清除它。這裡不會檢查型別"
961-
"以確保 *cause* 是一個例外實例或 ``None``。此函式「竊取」對 *cause* 的參照。"
963+
"以確保 *cause* 是一個例外實例或 ``None``。此函式「:term:`竊取 <steal>`」對 "
964+
"*cause* 的參照。"
962965

963966
#: ../../c-api/exceptions.rst:874
964967
msgid ""

c-api/gen.po

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ msgid ""
6666
"reference to *frame* is \":term:`stolen <steal>`\" by this function (even on "
6767
"error). The argument must not be ``NULL``."
6868
msgstr ""
69-
"基於 *frame* 物件建立並回傳一個新的產生器物件。此函式會「竊取」對 *frame* 的"
70-
"一個參照(即使發生錯誤也一樣)。引數必須不為 ``NULL``。"
69+
"基於 *frame* 物件建立並回傳一個新的產生器物件。此函式會「:term:`竊取 "
70+
"<steal>`」對 *frame* 的一個參照(即使發生錯誤也一樣)。引數必須不為 "
71+
"``NULL``。"
7172

7273
#: ../../c-api/gen.rst:43
7374
msgid ""
@@ -77,8 +78,8 @@ msgid ""
7778
"The *frame* argument must not be ``NULL``."
7879
msgstr ""
7980
"基於 *frame* 物件建立並回傳一個新的產生器物件,其中 ``__name__`` 和 "
80-
"``__qualname__`` 設為 *name* 和 *qualname*。此函式會「竊取」對 *frame* 的一個"
81-
"參照(即使發生錯誤也一樣)。*frame* 引數必須不為 ``NULL``。"
81+
"``__qualname__`` 設為 *name* 和 *qualname*。此函式會「:term:`竊取 <steal>`」"
82+
"對 *frame* 的一個參照(即使發生錯誤也一樣)。*frame* 引數必須不為 ``NULL``。"
8283

8384
#: ../../c-api/gen.rst:51
8485
msgid ""
@@ -111,8 +112,8 @@ msgid ""
111112
"<steal>`\" by this function (even on error) and must not be ``NULL``."
112113
msgstr ""
113114
"建立一個包裝 *frame* 的非同步產生器,並將 ``__name__`` 和 ``__qualname__`` 設"
114-
"為 *name* 和 *qualname*。*frame* 會被此函式「竊取」(即使發生錯誤也一樣),且"
115-
"不得為 ``NULL``。"
115+
"為 *name* 和 *qualname*。*frame* 會被此函式「:term:`竊取 <steal>`」(即使發生"
116+
"錯誤也一樣),且不得為 ``NULL``。"
116117

117118
#: ../../c-api/gen.rst:75
118119
msgid ""

c-api/list.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ msgid ""
128128
"error. On success, it discards a reference to an item already in the list at "
129129
"the affected position (unless it was ``NULL``)."
130130
msgstr ""
131-
"此函式「竊取」對 *item* 的參照,即使發生錯誤也一樣。成功時,它會丟棄串列中受"
132-
"影響位置上已存在項目的參照(除非該項目為 ``NULL``)。"
131+
"此函式「:term:`竊取 <steal>`」對 *item* 的參照,即使發生錯誤也一樣。成功時,"
132+
"它會丟棄串列中受影響位置上已存在項目的參照(除非該項目為 ``NULL``)。"
133133

134134
#: ../../c-api/list.rst:113
135135
msgid ""
@@ -154,9 +154,9 @@ msgid ""
154154
"func:`PyList_SetItem`, does *not* discard a reference to any item that is "
155155
"being replaced; any reference in *list* at position *i* will be leaked."
156156
msgstr ""
157-
"該巨集「竊取」對 *item* 的參照,並且與 :c:func:`PyList_SetItem` 不同的是,它"
158-
"\\ *不會*\\ 丟棄對任意被替換項目的參照;*list* 中位置 *i* 的任何參照都將被洩"
159-
" (leak)。"
157+
"該巨集「:term:`竊取 <steal>`」對 *item* 的參照,並且與 :c:func:"
158+
"`PyList_SetItem` 不同的是,它\\ *不會*\\ 丟棄對任意被替換項目的參照;*list* "
159+
"中位置 *i* 的任何參照都將被洩漏 (leak)。"
160160

161161
#: ../../c-api/list.rst:129
162162
msgid ""

c-api/module.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,9 @@ msgid ""
651651
"function that returns a new reference without bothering to check its result "
652652
"or even saving it to a variable."
653653
msgstr ""
654-
"類似於 :c:func:`PyModule_AddObjectRef`,但會「竊取」對 *value* 的參照(即使發"
655-
"生錯誤也一樣)。它可以搭配某個回傳新參照之函式的結果來呼叫,而不需要費心檢查"
656-
"其結果,甚至不需要將其儲存到變數中。"
654+
"類似於 :c:func:`PyModule_AddObjectRef`,但會「:term:`竊取 <steal>`」對 "
655+
"*value* 的參照(即使發生錯誤也一樣)。它可以搭配某個回傳新參照之函式的結果來"
656+
"呼叫,而不需要費心檢查其結果,甚至不需要將其儲存到變數中。"
657657

658658
#: ../../c-api/module.rst:569
659659
msgid ""
@@ -670,8 +670,8 @@ msgid ""
670670
"Similar to :c:func:`PyModule_AddObjectRef`, but :term:`steals <steal>` a "
671671
"reference to *value* on success (if it returns ``0``)."
672672
msgstr ""
673-
"類似於 :c:func:`PyModule_AddObjectRef`,但在成功時(如果回傳 ``0``)會「竊"
674-
"取」對 *value* 的參照。"
673+
"類似於 :c:func:`PyModule_AddObjectRef`,但在成功時(如果回傳 ``0``)會\\ :"
674+
"term:`竊取 <steal>`\\ 對 *value* 的參照。"
675675

676676
#: ../../c-api/module.rst:581
677677
msgid ""

c-api/sequence.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ msgid ""
8383
"`steal`\" a reference to *v*."
8484
msgstr ""
8585
"將物件 *v* 指定給 *o* 的第 *i* 個元素。失敗時引發例外並回傳 ``-1``;成功時回"
86-
"傳 ``0``。這相當於 Python 陳述式 ``o[i] = v``。此函式\\ *不會*\\竊取」對 "
87-
"*v* 的參照。"
86+
"傳 ``0``。這相當於 Python 陳述式 ``o[i] = v``。此函式\\ *不會*\\:term:`竊"
87+
"取 <steal>`」對 *v* 的參照。"
8888

8989
#: ../../c-api/sequence.rst:72
9090
msgid ""

c-api/threads.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -926,11 +926,11 @@ msgid ""
926926
"thread is cleared. This raises no exceptions."
927927
msgstr ""
928928
"非同步地在執行緒中引發例外。*id* 引數為目標執行緒的執行緒 id;*exc* 為要引發"
929-
"的例外物件。此函式不會竊取任何對 *exc* 的參照。為了防止不當誤用,你必須自行編"
930-
" C 擴充來呼叫此函式。呼叫時必須具有 :term:`attached thread state`。回傳被修"
931-
"改的執行緒狀態數量;通常為一,但若找不到該執行緒 id 則為零。如果 *exc* 為 "
932-
"``NULL``,則會清除該執行緒的待處理例外(如果有的話)。此函式不會引發任何例"
933-
"。"
929+
"的例外物件。此函式不會\\ :term:`竊取 <steal>`\\ 任何對 *exc* 的參照。為了防止"
930+
"不當誤用,你必須自行編寫 C 擴充來呼叫此函式。呼叫時必須具有 :term:`attached "
931+
"thread state`。回傳被修改的執行緒狀態數量;通常為一,但若找不到該執行緒 id "
932+
"為零。如果 *exc* 為 ``NULL``,則會清除該執行緒的待處理例外(如果有的話)。"
933+
"函式不會引發任何例外。"
934934

935935
#: ../../c-api/threads.rst:750
936936
msgid ""

c-api/tuple.po

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ msgid ""
133133
"reference to an item already in the tuple at the affected position (unless "
134134
"it was NULL)."
135135
msgstr ""
136-
"此函式「竊取」對 *o* 的參照,並丟棄元組中該受影響位置上已存在項目的參照(除非"
137-
"該參照為 NULL)。"
136+
"此函式「:term:`竊取 <steal>`」對 *o* 的參照,並丟棄元組中該受影響位置上已存在"
137+
"項目的參照(除非該參照為 NULL)。"
138138

139139
#: ../../c-api/tuple.rst:100
140140
msgid ""
@@ -159,8 +159,9 @@ msgid ""
159159
"func:`PyTuple_SetItem`, does *not* discard a reference to any item that is "
160160
"being replaced; any reference in the tuple at position *pos* will be leaked."
161161
msgstr ""
162-
"此函式「竊取」對 *o* 的參照,且與 :c:func:`PyTuple_SetItem` 不同的是,此函式"
163-
"並\\ *不*\\ 丟棄任何被替換項目的參照;元組中 *pos* 位置的所有參照皆會被洩漏。"
162+
"此函式「:term:`竊取 <steal>`」對 *o* 的參照,且與 :c:func:`PyTuple_SetItem` "
163+
"不同的是,此函式並\\ *不*\\ 丟棄任何被替換項目的參照;元組中 *pos* 位置的所有"
164+
"參照皆會被洩漏。"
164165

165166
#: ../../c-api/tuple.rst:115
166167
msgid ""
@@ -320,7 +321,7 @@ msgstr ""
320321

321322
#: ../../c-api/tuple.rst:248
322323
msgid "This function \":term:`steals <steal>`\" a reference to *o*."
323-
msgstr "此函式「竊取」對 *o* 的參照。"
324+
msgstr "此函式「:term:`竊取 <steal>`」對 *o* 的參照。"
324325

325326
#: ../../c-api/tuple.rst:253
326327
msgid "Alias to :c:func:`PyStructSequence_SetItem`."

0 commit comments

Comments
 (0)