7
7
8
8
9
9
# Naisen Xu <[email protected] >, 2021
10
- # Freesand Leo <[email protected] >, 2025
11
10
# ppcfish <[email protected] >, 2025
11
+ # Freesand Leo <[email protected] >, 2025
12
12
#
13
13
#, fuzzy
14
14
msgid ""
15
15
msgstr ""
16
16
"Project-Id-Version : Python 3.14\n "
17
17
"Report-Msgid-Bugs-To : \n "
18
- "POT-Creation-Date : 2025-05-23 14:20 +0000\n "
18
+ "POT-Creation-Date : 2025-06-20 14:21 +0000\n "
19
19
"PO-Revision-Date : 2021-06-28 00:47+0000\n "
20
- "Last-Translator : ppcfish <ppcfish@gmail .com>, 2025\n "
20
+ "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2025\n "
21
21
"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
22
22
"MIME-Version : 1.0\n "
23
23
"Content-Type : text/plain; charset=UTF-8\n "
@@ -38,6 +38,9 @@ msgid ""
38
38
"slot). Specifically, this function does **not** call the object's "
39
39
":meth:`!__init__` method."
40
40
msgstr ""
41
+ "为新分配的对象 *op* 初始化它的类型和初始引用。 返回初始化后的对象。 对象的其他字段不会被初始化。 虽然被如此命名,但该函数与对象的 "
42
+ ":meth:`~object.__init__` 方法 (:c:member:`~PyTypeObject.tp_init` 槽位) 无关。 "
43
+ "具体而言,该函数 **不会** 调用对象的 :meth:`!__init__` 方法。"
41
44
42
45
#: ../../c-api/allocation.rst:24
43
46
msgid ""
@@ -46,12 +49,15 @@ msgid ""
46
49
":c:member:`!tp_alloc` for your type, prefer :c:func:`PyType_GenericAlloc` or"
47
50
" :c:func:`PyObject_New`."
48
51
msgstr ""
52
+ "总而言之,可将该函数视为一个低层级的例程。 如有可能请使用 :c:member:`~PyTypeObject.tp_alloc`。 要为你的类型实现 "
53
+ ":c:member:`!tp_alloc`,推荐使用 :c:func:`PyType_GenericAlloc` 或 "
54
+ ":c:func:`PyObject_New`。"
49
55
50
56
#: ../../c-api/allocation.rst:31
51
57
msgid ""
52
58
"This function only initializes the object's memory corresponding to the "
53
59
"initial :c:type:`PyObject` structure. It does not zero the rest."
54
- msgstr ""
60
+ msgstr "该函数只初始化与初始 :c:type:`PyObject` 结构体相对应的对象内存。 它不会为其余内存写入零值。 "
55
61
56
62
#: ../../c-api/allocation.rst:37
57
63
msgid ""
@@ -63,7 +69,7 @@ msgstr "它的功能和 :c:func:`PyObject_Init` 一样,并且会初始化变
63
69
msgid ""
64
70
"This function only initializes some of the object's memory. It does not "
65
71
"zero the rest."
66
- msgstr ""
72
+ msgstr "该函数只初始化对象的部分内存。 它不会为其余内存写入零值。 "
67
73
68
74
#: ../../c-api/allocation.rst:48
69
75
msgid ""
@@ -73,44 +79,56 @@ msgid ""
73
79
":c:func:`PyObject_Init`. The caller will own the only reference to the "
74
80
"object (i.e. its reference count will be one)."
75
81
msgstr ""
82
+ "通过调用 :c:func:`PyObject_Malloc` 分配内存并如 :c:func:`PyObject_Init` 那样将其初始化分配一个使用 "
83
+ "C 结构类型 *TYPE* 和 Python 类型对象 *typeobj* (``PyTypeObject*``) 的新 Python 对象。 "
84
+ "调用方将拥有对该对象的唯一引用(即其引用计数将为一)。"
76
85
77
86
#: ../../c-api/allocation.rst:54 ../../c-api/allocation.rst:107
78
87
msgid ""
79
88
"Avoid calling this directly to allocate memory for an object; call the "
80
89
"type's :c:member:`~PyTypeObject.tp_alloc` slot instead."
81
- msgstr ""
90
+ msgstr "请避免直接调用此函数为对象分配内存;而应调用类型的 :c:member:`~PyTypeObject.tp_alloc` 槽位。 "
82
91
83
92
#: ../../c-api/allocation.rst:57 ../../c-api/allocation.rst:110
84
93
msgid ""
85
94
"When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, "
86
95
":c:func:`PyType_GenericAlloc` is preferred over a custom function that "
87
96
"simply calls this macro."
88
97
msgstr ""
98
+ "在填充类型的 :c:member:`~PyTypeObject.tp_alloc` 槽位时,推荐使用 "
99
+ ":c:func:`PyType_GenericAlloc` 而不是使用简单调用此宏的自定义函数。"
89
100
90
101
#: ../../c-api/allocation.rst:61
91
102
msgid ""
92
103
"This macro does not call :c:member:`~PyTypeObject.tp_alloc`, "
93
104
":c:member:`~PyTypeObject.tp_new` (:meth:`~object.__new__`), or "
94
105
":c:member:`~PyTypeObject.tp_init` (:meth:`~object.__init__`)."
95
106
msgstr ""
107
+ "这个宏不会调用 :c:member:`~PyTypeObject.tp_alloc`, :c:member:`~PyTypeObject.tp_new`"
108
+ " (:meth:`~object.__new__`) 或 :c:member:`~PyTypeObject.tp_init` "
109
+ "(:meth:`~object.__init__`)。"
96
110
97
111
#: ../../c-api/allocation.rst:65
98
112
msgid ""
99
113
"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in "
100
114
":c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` instead."
101
115
msgstr ""
116
+ "这不能被用于在 :c:member:`~PyTypeObject.tp_flags` 中设置了 "
117
+ ":c:macro:`Py_TPFLAGS_HAVE_GC` 的对象;请改用 :c:macro:`PyObject_GC_New`。"
102
118
103
119
#: ../../c-api/allocation.rst:68
104
120
msgid ""
105
121
"Memory allocated by this macro must be freed with :c:func:`PyObject_Free` "
106
122
"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)."
107
123
msgstr ""
124
+ "由此宏分配的内存必须用 :c:func:`PyObject_Free` 来释放(一般是通过对象的 "
125
+ ":c:member:`~PyTypeObject.tp_free` 槽位进行调用)。"
108
126
109
127
#: ../../c-api/allocation.rst:73 ../../c-api/allocation.rst:123
110
128
msgid ""
111
129
"The returned memory is not guaranteed to have been completely zeroed before "
112
130
"it was initialized."
113
- msgstr ""
131
+ msgstr "返回的内存并不保证在其初始化之前被完全置为零值。 "
114
132
115
133
#: ../../c-api/allocation.rst:78 ../../c-api/allocation.rst:128
116
134
msgid ""
@@ -119,71 +137,80 @@ msgid ""
119
137
":c:member:`~PyTypeObject.tp_init`. To construct a fully initialized object,"
120
138
" call *typeobj* instead. For example::"
121
139
msgstr ""
140
+ "此宏并不会构造给定类型的完全初始化的对象;它只是分配内存并准备好由 :c:member:`~PyTypeObject.tp_init` 来进一步初始化。"
141
+ " 要构造完全初始化的对象,应改为调用 *typeobj*。 例如::"
122
142
123
143
#: ../../c-api/allocation.rst:83
124
144
msgid "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);"
125
- msgstr ""
145
+ msgstr "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type); "
126
146
127
147
#: ../../c-api/allocation.rst:87 ../../c-api/allocation.rst:137
128
148
msgid ":c:func:`PyObject_Free`"
129
149
msgstr ":c:func:`PyObject_Free`"
130
150
131
151
#: ../../c-api/allocation.rst:88
132
152
msgid ":c:macro:`PyObject_GC_New`"
133
- msgstr ""
153
+ msgstr ":c:macro:`PyObject_GC_New` "
134
154
135
155
#: ../../c-api/allocation.rst:89 ../../c-api/allocation.rst:139
136
156
msgid ":c:func:`PyType_GenericAlloc`"
137
- msgstr ""
157
+ msgstr ":c:func:`PyType_GenericAlloc` "
138
158
139
159
#: ../../c-api/allocation.rst:90 ../../c-api/allocation.rst:140
140
160
msgid ":c:member:`~PyTypeObject.tp_alloc`"
141
161
msgstr ":c:member:`~PyTypeObject.tp_alloc`"
142
162
143
163
#: ../../c-api/allocation.rst:95
144
164
msgid "Like :c:macro:`PyObject_New` except:"
145
- msgstr ""
165
+ msgstr "如 :c:macro:`PyObject_New` 异常: "
146
166
147
167
#: ../../c-api/allocation.rst:97
148
168
msgid ""
149
169
"It allocates enough memory for the *TYPE* structure plus *size* "
150
170
"(``Py_ssize_t``) fields of the size given by the "
151
171
":c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*."
152
172
msgstr ""
173
+ "它将分配足够容纳 *TYPE* 结构加上由 *typeobj* 的 :c:member:`~PyTypeObject.tp_itemsize` "
174
+ "字段所给出的大小的 *size* (``Py_ssize_t``) 个字段的内存。"
153
175
154
176
#: ../../c-api/allocation.rst:100
155
177
msgid "The memory is initialized like :c:func:`PyObject_InitVar`."
156
- msgstr ""
178
+ msgstr "该内存将像 :c:func:`PyObject_InitVar` 一样被初始化。 "
157
179
158
180
#: ../../c-api/allocation.rst:102
159
181
msgid ""
160
182
"This is useful for implementing objects like tuples, which are able to "
161
183
"determine their size at construction time. Embedding the array of fields "
162
184
"into the same allocation decreases the number of allocations, improving the "
163
185
"memory management efficiency."
164
- msgstr ""
186
+ msgstr "这适用于实现像元组那样的对象,它能够在构造时确定其大小。 通过将字段数组嵌入到同样的分配块减去分配块数量,提高了内存管理效率。 "
165
187
166
188
#: ../../c-api/allocation.rst:114
167
189
msgid ""
168
190
"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in "
169
191
":c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar` "
170
192
"instead."
171
193
msgstr ""
194
+ "这不能被用于在 :c:member:`~PyTypeObject.tp_flags` 中设置了 "
195
+ ":c:macro:`Py_TPFLAGS_HAVE_GC` 的对象;请改用 :c:macro:`PyObject_GC_NewVar`。"
172
196
173
197
#: ../../c-api/allocation.rst:118
174
198
msgid ""
175
199
"Memory allocated by this function must be freed with :c:func:`PyObject_Free`"
176
200
" (usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)."
177
201
msgstr ""
202
+ "由此函数分配的内存必须用 :c:func:`PyObject_Free` 来释放(一般是通过对象的 "
203
+ ":c:member:`~PyTypeObject.tp_free` 槽位进行调用)。"
178
204
179
205
#: ../../c-api/allocation.rst:133
180
206
msgid ""
181
207
"PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);"
182
208
msgstr ""
209
+ "PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);"
183
210
184
211
#: ../../c-api/allocation.rst:138
185
212
msgid ":c:macro:`PyObject_GC_NewVar`"
186
- msgstr ""
213
+ msgstr ":c:macro:`PyObject_GC_NewVar` "
187
214
188
215
#: ../../c-api/allocation.rst:145
189
216
msgid "Same as :c:func:`PyObject_Free`."
@@ -198,8 +225,8 @@ msgstr ""
198
225
"这个对象是像 ``None`` 一样的 Python 对象。它可以使用 :c:macro:`Py_None` 宏访问,该宏的拿到指向该对象的指针。"
199
226
200
227
#: ../../c-api/allocation.rst:156
201
- msgid ":c:func:`PyModule_Create `"
202
- msgstr ":c:func:`PyModule_Create `"
228
+ msgid ":ref:`moduleobjects `"
229
+ msgstr ":ref:`moduleobjects `"
203
230
204
231
#: ../../c-api/allocation.rst:157
205
232
msgid "To allocate and create extension modules."
0 commit comments