@@ -369,12 +369,15 @@ msgid ""
369369"``o->ob_type``, which returns a pointer of type :c:type:`PyTypeObject*`, "
370370"except when the incremented reference count is needed."
371371msgstr ""
372+ "当 *o* 非 ``NULL`` 时,返回一个与对象 *o* 的类型相对应的类型对象。失败时,引发 :exc:`SystemError` 并返回 "
373+ "``NULL``。这等同于 Python 表达式 ``type(o)``。该函数会增加返回值的引用计数。实际上没有理由不去用普通的表达式 "
374+ "``o->ob_type`` 而使用该函数,表达式会返回一个类型指针 :c:type:`PyTypeObject*` ,除非需要增加引用计数。"
372375
373376#: ../../c-api/object.rst:300
374377msgid ""
375378"Return non-zero if the object *o* is of type *type* or a subtype of *type*, "
376379"and ``0`` otherwise. Both parameters must be non-``NULL``."
377- msgstr ""
380+ msgstr "如果对象 *o* 是 *type* 类型或其子类型,则返回非零,否则返回 ``0``。两个参数都必须非 ``NULL``。 "
378381
379382#: ../../c-api/object.rst:309
380383msgid ""
@@ -383,6 +386,8 @@ msgid ""
383386"``-1`` is returned. This is the equivalent to the Python expression "
384387"``len(o)``."
385388msgstr ""
389+ "返回对象 *o* 的长度。 如果对象 *o* 支持序列和映射协议,则返回序列长度。 出错时返回 ``-1``。这等同于 Python 表达式 "
390+ "``len(o)``。"
386391
387392#: ../../c-api/object.rst:316
388393msgid ""
@@ -392,12 +397,15 @@ msgid ""
392397"equivalent to the Python expression ``operator.length_hint(o, "
393398"defaultvalue)``."
394399msgstr ""
400+ "返回对象 *o* 的估计长度。首先尝试返回实际长度,然后用 :meth:`~object.__length_hint__` "
401+ "进行估计,最后返回默认值。出错时返回``-1``。这等同于 Python 表达式 ``operator.length_hint(o, "
402+ "defaultvalue)``。"
395403
396404#: ../../c-api/object.rst:326
397405msgid ""
398406"Return element of *o* corresponding to the object *key* or ``NULL`` on "
399407"failure. This is the equivalent of the Python expression ``o[key]``."
400- msgstr ""
408+ msgstr "返回对象 *key* 对应的 *o* 元素,或在失败时返回 ``NULL``。这等同于 Python 表达式 ``o[key]``。 "
401409
402410#: ../../c-api/object.rst:332
403411msgid ""
@@ -406,12 +414,14 @@ msgid ""
406414"statement ``o[key] = v``. This function *does not* steal a reference to "
407415"*v*."
408416msgstr ""
417+ "将对象 *key* 映射到值 *v*。 失败时引发异常并返回 ``-1``;成功时返回 ``0``。 这相当于 Python 语句 ``o[key] ="
418+ " v``。该函数 *不会* 偷取 *v* 的引用计数。"
409419
410420#: ../../c-api/object.rst:340
411421msgid ""
412422"Remove the mapping for the object *key* from the object *o*. Return ``-1`` "
413423"on failure. This is equivalent to the Python statement ``del o[key]``."
414- msgstr ""
424+ msgstr "从对象 *o* 中移除对象 *key* 的映射。失败时返回 ``-1``。 这相当于 Python 语句 ``del o[key]``。 "
415425
416426#: ../../c-api/object.rst:346
417427msgid ""
@@ -422,6 +432,9 @@ msgid ""
422432"case, if no execution frame is active then ``NULL`` is returned but "
423433":c:func:`PyErr_Occurred` will return false."
424434msgstr ""
435+ "相当于 Python 表达式 ``dir(o)``,返回一个(可能为空)适合对象参数的字符串列表,如果出错则返回 ``NULL``。 如果参数为 "
436+ "``NULL``,类似 Python 的 ``dir()``,则返回当前 locals 的名字;这时如果没有活动的执行框架,则返回 ``NULL``,但"
437+ " :c:func:`PyErr_Occurred` 将返回 false。"
425438
426439#: ../../c-api/object.rst:355
427440msgid ""
0 commit comments