@@ -27,52 +27,54 @@ msgstr "參照計數"
27
27
msgid ""
28
28
"The macros in this section are used for managing reference counts of Python "
29
29
"objects."
30
- msgstr ""
30
+ msgstr "本節中的巨集用於管理 Python 物件的參照計數。 "
31
31
32
32
#: ../../c-api/refcounting.rst:16
33
33
msgid "Increment the reference count for object *o*."
34
- msgstr ""
34
+ msgstr "增加物件 *o* 的參照計數。 "
35
35
36
36
#: ../../c-api/refcounting.rst:18
37
37
msgid ""
38
38
"This function is usually used to convert a :term:`borrowed reference` to a :"
39
39
"term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be "
40
40
"used to create a new :term:`strong reference`."
41
- msgstr ""
41
+ msgstr "此函式通常用於將\\ :term:`借用參照 <borrowed reference>`\\ 原地 (in-place) 轉換為\\ :term:`強參照 <strong reference>`。:c:func:`Py_NewRef` "
42
+ "函式可用於建立新的\\ :term:`強參照 <strong reference>`。"
42
43
43
44
#: ../../c-api/refcounting.rst:22
44
45
msgid ""
45
46
"The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, "
46
47
"use :c:func:`Py_XINCREF`."
47
- msgstr ""
48
+ msgstr "該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請使用 :c:func:`Py_XINCREF`。 "
48
49
49
50
#: ../../c-api/refcounting.rst:28
50
51
msgid ""
51
52
"Increment the reference count for object *o*. The object may be ``NULL``, "
52
53
"in which case the macro has no effect."
53
- msgstr ""
54
+ msgstr "增加物件 *o* 的參照計數。該物件可能是 ``NULL``,在這種情況下巨集不起作用。 "
54
55
55
56
#: ../../c-api/refcounting.rst:31
56
57
msgid "See also :c:func:`Py_XNewRef`."
57
- msgstr "另請見 :c:func:`Py_XNewRef`\\ 。"
58
+ msgstr "另請見 :c:func:`Py_XNewRef`。"
58
59
59
60
#: ../../c-api/refcounting.rst:36
60
61
msgid ""
61
62
"Create a new :term:`strong reference` to an object: increment the reference "
62
63
"count of the object *o* and return the object *o*."
63
- msgstr ""
64
+ msgstr "建立對物件的新 \\ :term:`強參照 <strong reference>`:增加物件 *o* 的參照計數並回傳物件 *o*。 "
64
65
65
66
#: ../../c-api/refcounting.rst:39
66
67
msgid ""
67
68
"When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF` "
68
69
"should be called on it to decrement the object reference count."
69
- msgstr ""
70
+ msgstr "當不再需要 \\ :term:`強參照 <strong reference>` \\ 時,應對其呼叫 :c:func:`Py_DECREF` 以減少物件參照計數。 "
70
71
71
72
#: ../../c-api/refcounting.rst:42
72
73
msgid ""
73
74
"The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be "
74
75
"``NULL``."
75
- msgstr ""
76
+ msgstr "物件 *o* 不能為 ``NULL``;如果 *o* 可以為 "
77
+ "``NULL``,則使用 :c:func:`Py_XNewRef`。"
76
78
77
79
#: ../../c-api/refcounting.rst:45
78
80
msgid "For example::"
@@ -94,33 +96,33 @@ msgstr "另請參閱 :c:func:`Py_INCREF`\\ 。"
94
96
95
97
#: ../../c-api/refcounting.rst:61
96
98
msgid "Similar to :c:func:`Py_NewRef`, but the object *o* can be NULL."
97
- msgstr ""
99
+ msgstr "與 :c:func:`Py_NewRef` 類似,但物件 *o* 可以為 NULL。 "
98
100
99
101
#: ../../c-api/refcounting.rst:63
100
102
msgid "If the object *o* is ``NULL``, the function just returns ``NULL``."
101
- msgstr ""
103
+ msgstr "如果物件 *o* 為 ``NULL``,則該函式僅回傳 ``NULL``。 "
102
104
103
105
#: ../../c-api/refcounting.rst:70
104
106
msgid "Decrement the reference count for object *o*."
105
- msgstr ""
107
+ msgstr "減少物件 *o* 的參照計數。 "
106
108
107
109
#: ../../c-api/refcounting.rst:72
108
110
msgid ""
109
111
"If the reference count reaches zero, the object's type's deallocation "
110
112
"function (which must not be ``NULL``) is invoked."
111
- msgstr ""
113
+ msgstr "如果參照計數達到零,則調用物件之型別的釋放函式 (deallocation function)(不得為 ``NULL``)。 "
112
114
113
115
#: ../../c-api/refcounting.rst:75
114
116
msgid ""
115
117
"This function is usually used to delete a :term:`strong reference` before "
116
118
"exiting its scope."
117
- msgstr ""
119
+ msgstr "此函式通常用於在退出作用域之前刪除 \\ :term:`強參照 <strong reference>`。 "
118
120
119
121
#: ../../c-api/refcounting.rst:78
120
122
msgid ""
121
123
"The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, "
122
124
"use :c:func:`Py_XDECREF`."
123
- msgstr ""
125
+ msgstr "該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請改用 :c:func:`Py_XDECREF`。 "
124
126
125
127
#: ../../c-api/refcounting.rst:83
126
128
msgid ""
@@ -134,13 +136,21 @@ msgid ""
134
136
"update the list data structure, and then call :c:func:`Py_DECREF` for the "
135
137
"temporary variable."
136
138
msgstr ""
139
+ "釋放函式可以導致任意 Python 程式碼被調用(例如,當釋放具有 :meth:`__del__` "
140
+ "方法的類別實例時)。雖然此類程式碼中的例外不會被傳遞出來,但"
141
+ "執行的程式碼可以自由存取所有 Python 全域變數。這意味著在調用 :c:"
142
+ "func:`Py_DECREF` 之前,"
143
+ "可從全域變數存取的任何物件都應處於一致狀態。例如,從 list 中刪除物件的程式碼應"
144
+ "將已刪除物件的參照複製到臨時變數中,更新 list 資料結構,然後為臨時變數呼叫 "
145
+ ":c:func:`Py_DECREF`。"
137
146
138
147
#: ../../c-api/refcounting.rst:95
139
148
msgid ""
140
149
"Decrement the reference count for object *o*. The object may be ``NULL``, "
141
150
"in which case the macro has no effect; otherwise the effect is the same as "
142
151
"for :c:func:`Py_DECREF`, and the same warning applies."
143
- msgstr ""
152
+ msgstr "減少物件 *o* 的參照計數。該物件可能是 ``NULL``,在這種情況下巨集不起作用;"
153
+ "否則效果與 :c:func:`Py_DECREF` 相同,且使得應用了相同的警告。"
144
154
145
155
#: ../../c-api/refcounting.rst:102
146
156
msgid ""
@@ -151,28 +161,39 @@ msgid ""
151
161
"object passed because the macro carefully uses a temporary variable and sets "
152
162
"the argument to ``NULL`` before decrementing its reference count."
153
163
msgstr ""
164
+ "減少物件 *o* 的參照計數。該物件可能是 ``NULL``,在這種情況下巨集不起作用;否則,"
165
+ "效果與 :c:func:`Py_DECREF` 相同,只是引數也設定為 ``NULL``。:c:func:`Py_DECREF "
166
+ "的警告不適用於傳遞的物件,"
167
+ "因為巨集在遞減其參照計數之前小心地使用臨時變數並將參數設定為 ``NULL``。"
154
168
155
169
#: ../../c-api/refcounting.rst:109
156
170
msgid ""
157
171
"It is a good idea to use this macro whenever decrementing the reference "
158
172
"count of an object that might be traversed during garbage collection."
159
- msgstr ""
173
+ msgstr "每當要減少垃圾收集期間可能被遍歷到之物件的參照計數時,使用此巨集是個好主意。 "
160
174
161
175
#: ../../c-api/refcounting.rst:114
162
176
msgid ""
163
177
"Increment the reference count for object *o*. A function version of :c:func:"
164
178
"`Py_XINCREF`. It can be used for runtime dynamic embedding of Python."
165
- msgstr ""
179
+ msgstr "增加物件 *o* 的參照計數。:c:func:"
180
+ "`Py_XINCREF` "
181
+ "的函式版本。它可用於 Python 的執行環境動態嵌入。"
166
182
167
183
#: ../../c-api/refcounting.rst:120
168
184
msgid ""
169
185
"Decrement the reference count for object *o*. A function version of :c:func:"
170
186
"`Py_XDECREF`. It can be used for runtime dynamic embedding of Python."
171
- msgstr ""
187
+ msgstr "減少物件 *o* 的參照計數。:c:func:"
188
+ "`Py_XDECREF` "
189
+ "的函式版本。它可用於 Python 的執行環境動態嵌入。"
172
190
173
191
#: ../../c-api/refcounting.rst:124
174
192
msgid ""
175
193
"The following functions or macros are only for use within the interpreter "
176
194
"core: :c:func:`_Py_Dealloc`, :c:func:`_Py_ForgetReference`, :c:func:"
177
195
"`_Py_NewReference`, as well as the global variable :c:data:`_Py_RefTotal`."
178
196
msgstr ""
197
+ "以下函式或巨集僅在直譯器核心內使用::c:func:`_Py_Dealloc`、:c:func:`_Py_Forge"
198
+ "tReference`、:c:func:`_Py_NewReference` 以及全域變數 "
199
+ ":c:data:`_Py_RefTotal`。"
0 commit comments