Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a4c888e

Browse files
[po] auto sync
1 parent 50e3e47 commit a4c888e

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

extending/newtypes.po

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ msgid ""
136136
":c:member:`~PyTypeObject.tp_dealloc` again, causing a double free and a "
137137
"crash."
138138
msgstr ""
139+
"你能在释放器函数中安全执行的操作是有限的。 首先,如果你的类型支持垃圾回收 (使用 "
140+
":c:member:`~PyTypeObject.tp_traverse` 和/或 "
141+
":c:member:`~PyTypeObject.tp_clear`),对象的部分成员可以在调用 "
142+
":c:member:`~PyTypeObject.tp_dealloc` 时被清空或终结。 其次,在 "
143+
":c:member:`~PyTypeObject.tp_dealloc` 中,你的对象将处于不稳定状态:它的引用计数等于零。 任何对非琐碎对象或 API"
144+
" 的调用 (如上面的示例所做的) 最终都可能会再次调用 "
145+
":c:member:`~PyTypeObject.tp_dealloc`,导致双重释放并发生崩溃。"
139146

140147
#: ../../extending/newtypes.rst:131
141148
msgid ""
@@ -193,6 +200,11 @@ msgid ""
193200
"intended for human consumption. If :c:member:`~PyTypeObject.tp_str` is not "
194201
"specified, the :c:member:`~PyTypeObject.tp_repr` handler is used instead."
195202
msgstr ""
203+
":c:member:`~PyTypeObject.tp_str` 处理句柄对于 :func:`str` 就如上述的 "
204+
":c:member:`~PyTypeObject.tp_repr` 处理句柄对于 :func:`repr` 一样;也就是说,它会在当 Python "
205+
"代码在你的对象的某个实例上调用 :func:`str` 时被调用。 它的实现与 :c:member:`~PyTypeObject.tp_repr` "
206+
"函数非常相似,但其结果字符串是供人类查看的。 如果未指定 :c:member:`~PyTypeObject.tp_str`,则会使用 "
207+
":c:member:`~PyTypeObject.tp_repr` 重句柄来代替。"
196208

197209
#: ../../extending/newtypes.rst:176
198210
msgid "Here is a simple example::"
@@ -211,6 +223,9 @@ msgid ""
211223
"an attribute is a special case, for which the new value passed to the "
212224
"handler is ``NULL``."
213225
msgstr ""
226+
"对于每个可支持属性操作的对象,相应的类型必须提供用于控制属性获取方式的函数。 "
227+
"需要有一个能够检索属性的函数(如果定义了任何属性)还要有另一个函数负责设置属性(如果允许设置属性)。 "
228+
"移除属性是一种特殊情况,在此情况下要传给处理句柄的新值为 ``NULL``。"
214229

215230
#: ../../extending/newtypes.rst:196
216231
msgid ""
@@ -221,6 +236,8 @@ msgid ""
221236
"type can use whichever pair makes more sense for the implementation's "
222237
"convenience. ::"
223238
msgstr ""
239+
"Python 支持两对属性处理句柄;一个支持属性操作的类型只需要实现其中一对的函数。 两者的差别在于一对接受 :c:type:`char\\*` "
240+
"作为属性名称,而另一对则接受 :c:type:`PyObject\\*`。 每种类型都可以选择使用对于实现的便利性来说更有意义的那一对。 ::"
224241

225242
#: ../../extending/newtypes.rst:208
226243
msgid ""
@@ -232,6 +249,9 @@ msgid ""
232249
"examples which have not been updated to use some of the new generic "
233250
"mechanism that is available."
234251
msgstr ""
252+
"如果访问一个对象的属性总是属于简单操作(这将在下文进行解释),则有一些泛用实现可被用来提供 :c:type:`PyObject\\*` "
253+
"版本的属性管理函数。 从 Python 2.2 "
254+
"开始对于类型专属的属性处理句柄的实际需要几乎已完全消失,尽管还存在着许多尚未更新为使用某种新的可选泛用机制的例子。"
235255

236256
#: ../../extending/newtypes.rst:219
237257
msgid "Generic Attribute Management"

0 commit comments

Comments
 (0)