55#
66# Translators:
77# Shengjing Zhu <[email protected] >, 20208- # Freesand Leo <[email protected] >, 202098# Meng Du <[email protected] >, 20201091110# ppcfish <[email protected] >, 20201211# Chao Sean <[email protected] >, 202012+ # Freesand Leo <[email protected] >, 20201313#
1414#, fuzzy
1515msgid ""
@@ -18,7 +18,7 @@ msgstr ""
1818"Report-Msgid-Bugs-To : \n "
1919"POT-Creation-Date : 2020-02-21 12:45+0000\n "
2020"PO-Revision-Date : 2020-05-30 11:49+0000\n "
21- "Last-Translator : Chao Sean <SeanChao0804@gmail .com>, 2020\n "
21+ "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2020\n "
2222"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2323"MIME-Version : 1.0\n "
2424"Content-Type : text/plain; charset=UTF-8\n "
@@ -115,19 +115,27 @@ msgid ""
115115"in the previous example, the allocated memory for the I/O buffer escapes "
116116"completely the Python memory manager."
117117msgstr ""
118+ "然而,在大多数情况下,建议专门从 Python 堆中分配内存,因为后者由 Python 内存管理器控制。例如,当解释器扩展了用 C "
119+ "写的新对象类型时,就必须这样做。使用 Python 堆的另一个原因是希望*通知* Python "
120+ "内存管理器关于扩展模块的内存需求。即使所请求的内存全部只用于内部的、高度特定的目的,将所有的内存请求交给 Python "
121+ "内存管理器能让解释器对其内存占用的整体情况有更准确的了解。因此,在某些情况下,Python "
122+ "内存管理器可能会触发或不触发适当的操作,如垃圾回收、内存压缩或其他预防性操作。请注意,通过使用前面例子中所示的 C 库分配器,为 I/O "
123+ "缓冲区分配的内存会完全不受 Python 内存管理器管理。"
118124
119125#: ../../c-api/memory.rst:88
120126msgid ""
121127"The :envvar:`PYTHONMALLOC` environment variable can be used to configure the"
122128" memory allocators used by Python."
123- msgstr ""
129+ msgstr "环境变量 :envvar:`PYTHONMALLOC` 可被用来配置 Python 所使用的内存分配器。 "
124130
125131#: ../../c-api/memory.rst:91
126132msgid ""
127133"The :envvar:`PYTHONMALLOCSTATS` environment variable can be used to print "
128134"statistics of the :ref:`pymalloc memory allocator <pymalloc>` every time a "
129135"new pymalloc object arena is created, and on shutdown."
130136msgstr ""
137+ "环境变量 :envvar:`PYTHONMALLOCSTATS` 可以用来在每次创建和关闭新的 pymalloc 对象区域时打印 "
138+ ":ref:`pymalloc 内存分配器 <pymalloc>` 的统计数据。"
131139
132140#: ../../c-api/memory.rst:97
133141msgid "Raw Memory Interface"
@@ -156,14 +164,15 @@ msgstr ""
156164msgid ""
157165"Allocates *n* bytes and returns a pointer of type :c:type:`void\\ *` to the "
158166"allocated memory, or ``NULL`` if the request fails."
159- msgstr ""
167+ msgstr "分配 *n* 个字节,并返回一个指向分配的内存的 :c:type:`void \\ *` 类型指针,如果请求失败,则返回 ``NULL`` 。 "
160168
161169#: ../../c-api/memory.rst:115
162170msgid ""
163171"Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, "
164172"as if ``PyMem_RawMalloc(1)`` had been called instead. The memory will not "
165173"have been initialized in any way."
166174msgstr ""
175+ "请求零字节可能返回一个独特的非 ``NULL`` 指针,就像调用了``PyMem_RawMalloc(1)`` 一样。但是内存不会以任何方式被初始化。"
167176
168177#: ../../c-api/memory.rst:122 ../../c-api/memory.rst:193
169178#: ../../c-api/memory.rst:295
@@ -172,40 +181,46 @@ msgid ""
172181"a pointer of type :c:type:`void\\ *` to the allocated memory, or ``NULL`` if "
173182"the request fails. The memory is initialized to zeros."
174183msgstr ""
184+ "分配 *nelem* 个元素,每个元素的大小为 *elsize* 字节,并返回指向分配的内存的 :c:type:`void*/` "
185+ "类型指针,如果请求失败,则返回``NULL``。内存被初始化为零。"
175186
176187#: ../../c-api/memory.rst:126
177188msgid ""
178189"Requesting zero elements or elements of size zero bytes returns a distinct "
179190"non-``NULL`` pointer if possible, as if ``PyMem_RawCalloc(1, 1)`` had been "
180191"called instead."
181- msgstr ""
192+ msgstr "请求零字节可能返回一个独特的非 ``NULL`` 指针,就像调用了``PyMem_RawCalloc(1, 1)`` 一样。 "
182193
183194#: ../../c-api/memory.rst:135 ../../c-api/memory.rst:206
184195#: ../../c-api/memory.rst:308
185196msgid ""
186197"Resizes the memory block pointed to by *p* to *n* bytes. The contents will "
187198"be unchanged to the minimum of the old and the new sizes."
188- msgstr ""
199+ msgstr "将 *p* 指向的内存块大小调整为 *n* 字节。以新旧内存块大小中的最小值为准,其中内容保持不变, "
189200
190201#: ../../c-api/memory.rst:138
191202msgid ""
192203"If *p* is ``NULL``, the call is equivalent to ``PyMem_RawMalloc(n)``; else "
193204"if *n* is equal to zero, the memory block is resized but is not freed, and "
194205"the returned pointer is non-``NULL``."
195206msgstr ""
207+ "如果*p*是``NULL``,则相当于调用 ``PyMem_RawMalloc(n)`` ;如果 *n* 等于 "
208+ "0,则内存块大小会被调整,但不会被释放,返回非 ``NULL`` 指针。"
196209
197210#: ../../c-api/memory.rst:142
198211msgid ""
199212"Unless *p* is ``NULL``, it must have been returned by a previous call to "
200213":c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or "
201214":c:func:`PyMem_RawCalloc`."
202215msgstr ""
216+ "除非 *p* 是 ``NULL`` ,否则它必须是之前调用 :c:func:`PyMem_RawMalloc` 、 "
217+ ":c:func:`PyMem_RawRealloc` 或 :c:func:`PyMem_RawCalloc` 所返回的。"
203218
204219#: ../../c-api/memory.rst:146
205220msgid ""
206221"If the request fails, :c:func:`PyMem_RawRealloc` returns ``NULL`` and *p* "
207222"remains a valid pointer to the previous memory area."
208- msgstr ""
223+ msgstr "如果请求失败,:c:func:`PyMem_RawRealloc` 返回 ``NULL`` , *p* 仍然是指向先前内存区域的有效指针。 "
209224
210225#: ../../c-api/memory.rst:152
211226msgid ""
@@ -214,11 +229,14 @@ msgid ""
214229":c:func:`PyMem_RawCalloc`. Otherwise, or if ``PyMem_RawFree(p)`` has been "
215230"called before, undefined behavior occurs."
216231msgstr ""
232+ "释放 *p* 指向的内存块。除非 *p* 是 ``NULL`` ,否则它必须是之前调用 :c:func:`PyMem_RawMalloc` 、 "
233+ ":c:func:`PyMem_RawRealloc` 或 :c:func:`PyMem_RawCalloc` 所返回的指针。否则,或在 "
234+ "``PyMem_RawFree(p)`` 之前已经调用过的情况下,未定义的行为会发生。"
217235
218236#: ../../c-api/memory.rst:157 ../../c-api/memory.rst:227
219237#: ../../c-api/memory.rst:329
220238msgid "If *p* is ``NULL``, no operation is performed."
221- msgstr ""
239+ msgstr "如果 *p* 是 ``NULL``, 那么什么操作也不会进行。 "
222240
223241#: ../../c-api/memory.rst:163
224242msgid "Memory Interface"
@@ -229,57 +247,64 @@ msgid ""
229247"The following function sets, modeled after the ANSI C standard, but "
230248"specifying behavior when requesting zero bytes, are available for allocating"
231249" and releasing memory from the Python heap."
232- msgstr ""
250+ msgstr "以下函数集,仿照 ANSI C 标准,并指定了请求零字节时的行为,可用于从Python堆分配和释放内存。 "
233251
234252#: ../../c-api/memory.rst:169
235253msgid ""
236254"The :ref:`default memory allocator <default-memory-allocators>` uses the "
237255":ref:`pymalloc memory allocator <pymalloc>`."
238256msgstr ""
257+ ":ref:`默认内存分配器 <default-memory-allocators>` 使用了 :ref:`pymalloc 内存分配器 "
258+ "<pymalloc>`."
239259
240260#: ../../c-api/memory.rst:174 ../../c-api/memory.rst:280
241261msgid ""
242262"The :term:`GIL <global interpreter lock>` must be held when using these "
243263"functions."
244- msgstr ""
264+ msgstr "在使用这些函数时,必须持有 :term:`全局解释器锁(GIL) <global interpreter lock>` 。 "
245265
246266#: ../../c-api/memory.rst:179
247267msgid ""
248268"The default allocator is now pymalloc instead of system :c:func:`malloc`."
249- msgstr ""
269+ msgstr "现在默认的分配器是 pymalloc 而非系统的 :c:func:`malloc` 。 "
250270
251271#: ../../c-api/memory.rst:186
252272msgid ""
253273"Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, "
254274"as if ``PyMem_Malloc(1)`` had been called instead. The memory will not have "
255275"been initialized in any way."
256276msgstr ""
277+ "请求零字节可能返回一个独特的非 ``NULL`` 指针,就像调用了``PyMem_Malloc(1)`` 一样。但是内存不会以任何方式被初始化。"
257278
258279#: ../../c-api/memory.rst:197
259280msgid ""
260281"Requesting zero elements or elements of size zero bytes returns a distinct "
261282"non-``NULL`` pointer if possible, as if ``PyMem_Calloc(1, 1)`` had been "
262283"called instead."
263- msgstr ""
284+ msgstr "请求零字节可能返回一个独特的非 ``NULL`` 指针,就像调用了``PyMem_Calloc(1, 1)`` 一样。 "
264285
265286#: ../../c-api/memory.rst:209
266287msgid ""
267288"If *p* is ``NULL``, the call is equivalent to ``PyMem_Malloc(n)``; else if "
268289"*n* is equal to zero, the memory block is resized but is not freed, and the "
269290"returned pointer is non-``NULL``."
270291msgstr ""
292+ "如果*p*是``NULL``,则相当于调用 ``PyMem_Malloc(n)`` ;如果 *n* 等于 0,则内存块大小会被调整,但不会被释放,返回非"
293+ " ``NULL`` 指针。"
271294
272295#: ../../c-api/memory.rst:213
273296msgid ""
274297"Unless *p* is ``NULL``, it must have been returned by a previous call to "
275298":c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`."
276299msgstr ""
300+ "除非 *p* 是 ``NULL`` ,否则它必须是之前调用 :c:func:`PyMem_Malloc` 、 "
301+ ":c:func:`PyMem_Realloc` 或 :c:func:`PyMem_Calloc` 所返回的。"
277302
278303#: ../../c-api/memory.rst:216
279304msgid ""
280305"If the request fails, :c:func:`PyMem_Realloc` returns ``NULL`` and *p* "
281306"remains a valid pointer to the previous memory area."
282- msgstr ""
307+ msgstr "如果请求失败,:c:func:`PyMem_Realloc` 返回 ``NULL`` , *p* 仍然是指向先前内存区域的有效指针。 "
283308
284309#: ../../c-api/memory.rst:222
285310msgid ""
@@ -288,12 +313,15 @@ msgid ""
288313":c:func:`PyMem_Calloc`. Otherwise, or if ``PyMem_Free(p)`` has been called "
289314"before, undefined behavior occurs."
290315msgstr ""
316+ "释放 *p* 指向的内存块。除非 *p* 是 ``NULL`` ,否则它必须是之前调用 :c:func:`PyMem_Malloc` 、 "
317+ ":c:func:`PyMem_Realloc` 或 :c:func:`PyMem_Calloc` 所返回的指针。否则,或在 "
318+ "``PyMem_Free(p)`` 之前已经调用过的情况下,未定义的行为会发生。"
291319
292320#: ../../c-api/memory.rst:229
293321msgid ""
294322"The following type-oriented macros are provided for convenience. Note that"
295323" *TYPE* refers to any C type."
296- msgstr ""
324+ msgstr "以下面向类型的宏为方便而提供。 注意 *TYPE* 可以指任何 C 类型。 "
297325
298326#: ../../c-api/memory.rst:235
299327msgid ""
0 commit comments