Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita941077

Browse files
[po] auto sync
1 parent0d7f08f commita941077

31 files changed

+6917
-6170
lines changed

‎.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation":"78.51%","updated_at":"2025-05-23T06:15:15Z"}
1+
{"translation":"78.05%","updated_at":"2025-05-23T15:12:10Z"}

‎c-api/allocation.po

Lines changed: 140 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88
# Sonny <758896823@qq.com>, 2021
99
# Naisen Xu <723648649@qq.com>, 2021
1010
# Freesand Leo <yuqinju@163.com>, 2025
11+
# ppcfish <ppcfish@gmail.com>, 2025
1112
#
1213
#,fuzzy
1314
msgid ""
1415
msgstr ""
1516
"Project-Id-Version:Python 3.14\n"
1617
"Report-Msgid-Bugs-To:\n"
17-
"POT-Creation-Date:2025-05-09 14:19+0000\n"
18+
"POT-Creation-Date:2025-05-23 14:20+0000\n"
1819
"PO-Revision-Date:2021-06-28 00:47+0000\n"
19-
"Last-Translator:Freesand Leo <yuqinju@163.com>, 2025\n"
20+
"Last-Translator:ppcfish <ppcfish@gmail.com>, 2025\n"
2021
"Language-Team:Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2122
"MIME-Version:1.0\n"
2223
"Content-Type:text/plain; charset=UTF-8\n"
@@ -32,79 +33,174 @@ msgstr "在堆上分配对象"
3233
msgid""
3334
"Initialize a newly allocated object *op* with its type and initial "
3435
"reference. Returns the initialized object. Other fields of the object are "
35-
"not affected."
36-
msgstr"为新分配的对象 *op* 初始化它的类型和初始引用。 返回初始化后的对象。 对象的其他字段不会被影响。"
36+
"not initialized. Despite its name, this function is unrelated to the "
37+
"object's :meth:`~object.__init__` method (:c:member:`~PyTypeObject.tp_init` "
38+
"slot). Specifically, this function does **not** call the object's "
39+
":meth:`!__init__` method."
40+
msgstr""
3741

3842
#:../../c-api/allocation.rst:24
3943
msgid""
44+
"In general, consider this function to be a low-level routine. Use "
45+
":c:member:`~PyTypeObject.tp_alloc` where possible. For implementing "
46+
":c:member:`!tp_alloc` for your type, prefer :c:func:`PyType_GenericAlloc` or"
47+
" :c:func:`PyObject_New`."
48+
msgstr""
49+
50+
#:../../c-api/allocation.rst:31
51+
msgid""
52+
"This function only initializes the object's memory corresponding to the "
53+
"initial :c:type:`PyObject` structure. It does not zero the rest."
54+
msgstr""
55+
56+
#:../../c-api/allocation.rst:37
57+
msgid""
4058
"This does everything :c:func:`PyObject_Init` does, and also initializes the "
4159
"length information for a variable-size object."
4260
msgstr"它的功能和 :c:func:`PyObject_Init` 一样,并且会初始化变量大小对象的长度信息。"
4361

44-
#:../../c-api/allocation.rst:30
62+
#:../../c-api/allocation.rst:42
63+
msgid""
64+
"This function only initializes some of the object's memory. It does not "
65+
"zero the rest."
66+
msgstr""
67+
68+
#:../../c-api/allocation.rst:48
69+
msgid""
70+
"Allocates a new Python object using the C structure type *TYPE* and the "
71+
"Python type object *typeobj* (``PyTypeObject*``) by calling "
72+
":c:func:`PyObject_Malloc` to allocate memory and initializing it like "
73+
":c:func:`PyObject_Init`. The caller will own the only reference to the "
74+
"object (i.e. its reference count will be one)."
75+
msgstr""
76+
77+
#:../../c-api/allocation.rst:54../../c-api/allocation.rst:107
4578
msgid""
46-
"Allocate a new Python object using the C structure type *TYPE* and the "
47-
"Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the "
48-
"Python object header are not initialized. The caller will own the only "
49-
"reference to the object (i.e. its reference count will be one). The size of "
50-
"the memory allocation is determined from the "
51-
":c:member:`~PyTypeObject.tp_basicsize` field of the type object."
79+
"Avoid calling this directly to allocate memory for an object; call the "
80+
"type's :c:member:`~PyTypeObject.tp_alloc` slot instead."
5281
msgstr""
53-
"使用 C 结构类型 *TYPE* 和 Python 类型对象 *typeobj* (``PyTypeObject*``) 分配一个新的 Python "
54-
"对象。 f未在该 Python 对象标头中定义的字段不会被初始化。 调用方将拥有对该对象的唯一引用(即引用计数将为 1)。 内存分配的大小由类型对象的 "
55-
":c:member:`~PyTypeObject.tp_basicsize` 字段决定。"
5682

57-
#:../../c-api/allocation.rst:38
83+
#:../../c-api/allocation.rst:57../../c-api/allocation.rst:110
5884
msgid""
59-
"Note that this function is unsuitable if *typeobj* has "
60-
":c:macro:`Py_TPFLAGS_HAVE_GC` set. For such objects, use "
61-
":c:func:`PyObject_GC_New` instead."
85+
"When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, "
86+
":c:func:`PyType_GenericAlloc` is preferred over a custom function that "
87+
"simply calls this macro."
6288
msgstr""
63-
"请注意如果 *typeobj* 设置了 :c:macro:`Py_TPFLAGS_HAVE_GC` 则此函数将不适用。 对于这样的对象,请改用 "
64-
":c:func:`PyObject_GC_New`。"
6589

66-
#:../../c-api/allocation.rst:45
90+
#:../../c-api/allocation.rst:61
6791
msgid""
68-
"Allocate a new Python object using the C structure type *TYPE* and the "
69-
"Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the "
70-
"Python object header are not initialized. The allocated memory allows for "
71-
"the *TYPE* structure plus *size* (``Py_ssize_t``) fields of the size given "
72-
"by the :c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*. This is "
73-
"useful for implementing objects like tuples, which are able to determine "
74-
"their size at construction time. Embedding the array of fields into the "
75-
"same allocation decreases the number of allocations, improving the memory "
76-
"management efficiency."
92+
"This macro does not call :c:member:`~PyTypeObject.tp_alloc`, "
93+
":c:member:`~PyTypeObject.tp_new` (:meth:`~object.__new__`), or "
94+
":c:member:`~PyTypeObject.tp_init` (:meth:`~object.__init__`)."
7795
msgstr""
78-
"使用 C 结构类型 *TYPE* 和 Python 类型对象 *typeobj* (``PyTypeObject*``) 分配一个新的 Python "
79-
"对象。 未在该 Python 对象标头中定义的字段不会被初始化。 被分配的内存允许 *TYPE* 结构加 *typeobj* 的 "
80-
":c:member:`~PyTypeObject.tp_itemsize` 字段所给出的 *size* (``Py_ssize_t``) 个字段。 "
81-
"这对于实现像元组这样能够在构造时确定其大小的对象来说很有用。 将字段数组嵌入到相同的内在分配中可减少内存分配的次数,这提高了内存管理效率。"
8296

83-
#:../../c-api/allocation.rst:56
97+
#:../../c-api/allocation.rst:65
8498
msgid""
85-
"Note that this function is unsuitable if *typeobj* has "
86-
":c:macro:`Py_TPFLAGS_HAVE_GC` set. For such objects, use "
87-
":c:func:`PyObject_GC_NewVar` instead."
99+
"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in "
100+
":c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` instead."
101+
msgstr""
102+
103+
#:../../c-api/allocation.rst:68
104+
msgid""
105+
"Memory allocated by this macro must be freed with :c:func:`PyObject_Free` "
106+
"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)."
107+
msgstr""
108+
109+
#:../../c-api/allocation.rst:73../../c-api/allocation.rst:123
110+
msgid""
111+
"The returned memory is not guaranteed to have been completely zeroed before "
112+
"it was initialized."
113+
msgstr""
114+
115+
#:../../c-api/allocation.rst:78../../c-api/allocation.rst:128
116+
msgid""
117+
"This macro does not construct a fully initialized object of the given type; "
118+
"it merely allocates memory and prepares it for further initialization by "
119+
":c:member:`~PyTypeObject.tp_init`. To construct a fully initialized object,"
120+
" call *typeobj* instead. For example::"
121+
msgstr""
122+
123+
#:../../c-api/allocation.rst:83
124+
msgid"PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);"
125+
msgstr""
126+
127+
#:../../c-api/allocation.rst:87../../c-api/allocation.rst:137
128+
msgid":c:func:`PyObject_Free`"
129+
msgstr":c:func:`PyObject_Free`"
130+
131+
#:../../c-api/allocation.rst:88
132+
msgid":c:macro:`PyObject_GC_New`"
133+
msgstr""
134+
135+
#:../../c-api/allocation.rst:89../../c-api/allocation.rst:139
136+
msgid":c:func:`PyType_GenericAlloc`"
137+
msgstr""
138+
139+
#:../../c-api/allocation.rst:90../../c-api/allocation.rst:140
140+
msgid":c:member:`~PyTypeObject.tp_alloc`"
141+
msgstr":c:member:`~PyTypeObject.tp_alloc`"
142+
143+
#:../../c-api/allocation.rst:95
144+
msgid"Like :c:macro:`PyObject_New` except:"
145+
msgstr""
146+
147+
#:../../c-api/allocation.rst:97
148+
msgid""
149+
"It allocates enough memory for the *TYPE* structure plus *size* "
150+
"(``Py_ssize_t``) fields of the size given by the "
151+
":c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*."
152+
msgstr""
153+
154+
#:../../c-api/allocation.rst:100
155+
msgid"The memory is initialized like :c:func:`PyObject_InitVar`."
156+
msgstr""
157+
158+
#:../../c-api/allocation.rst:102
159+
msgid""
160+
"This is useful for implementing objects like tuples, which are able to "
161+
"determine their size at construction time. Embedding the array of fields "
162+
"into the same allocation decreases the number of allocations, improving the "
163+
"memory management efficiency."
164+
msgstr""
165+
166+
#:../../c-api/allocation.rst:114
167+
msgid""
168+
"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in "
169+
":c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar` "
170+
"instead."
171+
msgstr""
172+
173+
#:../../c-api/allocation.rst:118
174+
msgid""
175+
"Memory allocated by this function must be freed with :c:func:`PyObject_Free`"
176+
" (usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)."
177+
msgstr""
178+
179+
#:../../c-api/allocation.rst:133
180+
msgid""
181+
"PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);"
182+
msgstr""
183+
184+
#:../../c-api/allocation.rst:138
185+
msgid":c:macro:`PyObject_GC_NewVar`"
88186
msgstr""
89-
"请注意如果 *typeobj* 设置了 :c:macro:`Py_TPFLAGS_HAVE_GC` 则此函数将不适用。 对于这样的对象,请改用 "
90-
":c:func:`PyObject_GC_NewVar`。"
91187

92-
#:../../c-api/allocation.rst:63
188+
#:../../c-api/allocation.rst:145
93189
msgid"Same as :c:func:`PyObject_Free`."
94190
msgstr"与 :c:func:`PyObject_Free` 相同。"
95191

96-
#:../../c-api/allocation.rst:67
192+
#:../../c-api/allocation.rst:149
97193
msgid""
98194
"Object which is visible in Python as ``None``. This should only be accessed"
99195
" using the :c:macro:`Py_None` macro, which evaluates to a pointer to this "
100196
"object."
101197
msgstr""
102198
"这个对象是像 ``None`` 一样的 Python 对象。它可以使用 :c:macro:`Py_None` 宏访问,该宏的拿到指向该对象的指针。"
103199

104-
#:../../c-api/allocation.rst:74
200+
#:../../c-api/allocation.rst:156
105201
msgid":c:func:`PyModule_Create`"
106202
msgstr":c:func:`PyModule_Create`"
107203

108-
#:../../c-api/allocation.rst:75
204+
#:../../c-api/allocation.rst:157
109205
msgid"To allocate and create extension modules."
110206
msgstr"分配内存和创建扩展模块"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp