Skip to content

Commit 0bd52da

Browse files
[po] auto sync
1 parent 06ab337 commit 0bd52da

File tree

4 files changed

+387
-46
lines changed

4 files changed

+387
-46
lines changed

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "81.12%", "updated_at": "2025-07-10T07:38:00Z"}
1+
{"translation": "81.23%", "updated_at": "2025-07-11T10:14:32Z"}

c-api/typeobj.po

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
# Kevin Deng <kevindeng55+transifex@gmail.com>, 2024
2121
# Wulian233 <xiguawulian@gmail.com>, 2024
2222
# Rafael Fontenelle <rffontenelle@gmail.com>, 2025
23+
# 汇民 王 <whuim@qq.com>, 2025
2324
# Freesand Leo <yuqinju@163.com>, 2025
2425
#
2526
#, fuzzy
2627
msgid ""
2728
msgstr ""
2829
"Project-Id-Version: Python 3.14\n"
2930
"Report-Msgid-Bugs-To: \n"
30-
"POT-Creation-Date: 2025-06-27 14:20+0000\n"
31+
"POT-Creation-Date: 2025-07-04 14:20+0000\n"
3132
"PO-Revision-Date: 2021-06-28 00:50+0000\n"
3233
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2025\n"
3334
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
@@ -1796,6 +1797,8 @@ msgid ""
17961797
"instance, and call the type's :c:member:`~PyTypeObject.tp_free` function to "
17971798
"free the object itself."
17981799
msgstr ""
1800+
"析构函数应移除该实例所拥有的所有引用(例如,调用 :c:func:`Py_CLEAR`),释放该实例所拥有的所有内存缓冲区,并调用该类型的 "
1801+
":c:member:`~PyTypeObject.tp_free` 函数来释放对象本身。"
17991802

18001803
#: ../../c-api/typeobj.rst:689
18011804
msgid ""
@@ -1804,6 +1807,8 @@ msgid ""
18041807
" ensure you don't clobber a preexisting error indicator (the deallocation "
18051808
"could have occurred while processing a different error):"
18061809
msgstr ""
1810+
"如果您可能会调用那些可能设置错误指示器的函数,则必须使用 :c:func:`PyErr_GetRaisedException` 和 "
1811+
":c:func:`PyErr_SetRaisedException`,以确保不会破坏已存在的错误指示器(在处理另一个错误的过程中,可能已发生了内存释放):"
18071812

18081813
#: ../../c-api/typeobj.rst:694
18091814
msgid ""
@@ -1816,52 +1821,68 @@ msgid ""
18161821
" PyErr_SetRaisedException(exc);\n"
18171822
"}"
18181823
msgstr ""
1824+
"static void\n"
1825+
"foo_dealloc(foo_object *self)\n"
1826+
"{\n"
1827+
" PyObject *et, *ev, *etb;\n"
1828+
" PyObject *exc = PyErr_GetRaisedException();\n"
1829+
" ...\n"
1830+
" PyErr_SetRaisedException(exc);\n"
1831+
"}"
18191832

18201833
#: ../../c-api/typeobj.rst:705
18211834
msgid ""
18221835
"The dealloc handler itself must not raise an exception; if it hits an error "
18231836
"case it should call :c:func:`PyErr_FormatUnraisable` to log (and clear) an "
18241837
"unraisable exception."
18251838
msgstr ""
1839+
"释放处理程序本身不应引发异常;若遇到错误情况,应调用 :c:func:`PyErr_FormatUnraisable` 记录(并清除)不可抛出的异常。"
18261840

18271841
#: ../../c-api/typeobj.rst:709
18281842
msgid "No guarantees are made about when an object is destroyed, except:"
1829-
msgstr ""
1843+
msgstr "关于对象何时被销毁,不做任何保证,除非:"
18301844

18311845
#: ../../c-api/typeobj.rst:711
18321846
msgid ""
18331847
"Python will destroy an object immediately or some time after the final "
18341848
"reference to the object is deleted, unless its finalizer "
18351849
"(:c:member:`~PyTypeObject.tp_finalize`) subsequently resurrects the object."
18361850
msgstr ""
1851+
"Python "
1852+
"会在对象的最后一个引用被删除后立即销毁该对象,或者在一段时间后再销毁,除非其终结器(:c:member:`~PyTypeObject.tp_finalize`)在此期间重新激活了该对象。"
18371853

18381854
#: ../../c-api/typeobj.rst:715
18391855
msgid ""
18401856
"An object will not be destroyed while it is being automatically finalized "
18411857
"(:c:member:`~PyTypeObject.tp_finalize`) or automatically cleared "
18421858
"(:c:member:`~PyTypeObject.tp_clear`)."
18431859
msgstr ""
1860+
"在对象被自动终结(:c:member:`~PyTypeObject.tp_finalize`)或自动清理(:c:member:`~PyTypeObject.tp_clear`)的过程中,不会销毁该对象。"
18441861

18451862
#: ../../c-api/typeobj.rst:719
18461863
msgid ""
18471864
"CPython currently destroys an object immediately from :c:func:`Py_DECREF` "
18481865
"when the new reference count is zero, but this may change in a future "
18491866
"version."
1850-
msgstr ""
1867+
msgstr "当前 CPython 在引用计数归零时,会立即通过 :c:func:`Py_DECREF` 销毁对象,但这一行为在未来版本中可能会改变。"
18511868

18521869
#: ../../c-api/typeobj.rst:723
18531870
msgid ""
18541871
"It is recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the"
18551872
" beginning of :c:member:`!tp_dealloc` to guarantee that the object is always"
18561873
" finalized before destruction."
18571874
msgstr ""
1875+
"建议在 :c:member:`!tp_dealloc` 的开头调用 "
1876+
":c:func:`PyObject_CallFinalizerFromDealloc` 以确保对象在销毁前始终被终结。"
18581877

18591878
#: ../../c-api/typeobj.rst:727
18601879
msgid ""
18611880
"If the type supports garbage collection (the :c:macro:`Py_TPFLAGS_HAVE_GC` "
18621881
"flag is set), the destructor should call :c:func:`PyObject_GC_UnTrack` "
18631882
"before clearing any member fields."
18641883
msgstr ""
1884+
"若该类型支持垃圾回收(即设置了 :c:macro:`Py_TPFLAGS_HAVE_GC` 标志),则析构函数应在清理任何成员字段之前调用 "
1885+
":c:func:`PyObject_GC_UnTrack`。"
18651886

18661887
#: ../../c-api/typeobj.rst:731
18671888
msgid ""
@@ -1870,6 +1891,9 @@ msgid ""
18701891
" object is always cleared before destruction. Beware that "
18711892
":c:member:`!tp_clear` might have already been called."
18721893
msgstr ""
1894+
"允许从 :c:member:`!tp_dealloc` 方法中调用 "
1895+
":c:member:`~PyTypeObject.tp_clear`,以减少代码重复并确保对象在销毁前始终被清理。但需注意,:c:member:`!tp_clear`"
1896+
" 可能已被提前调用。"
18731897

18741898
#: ../../c-api/typeobj.rst:736
18751899
msgid ""
@@ -1878,6 +1902,8 @@ msgid ""
18781902
":c:func:`Py_DECREF`) after calling the type deallocator. See the example "
18791903
"code below.::"
18801904
msgstr ""
1905+
"如果该类型是堆分配的(:c:macro:`Py_TPFLAGS_HEAPTYPE`),则释放器应在调用类型释放器之后,释放对其类型对象的自有引用(通过 "
1906+
":c:func:`Py_DECREF`)。参见下面的示例代码。::"
18811907

18821908
#: ../../c-api/typeobj.rst:741
18831909
msgid ""
@@ -1890,6 +1916,14 @@ msgid ""
18901916
" Py_TYPE(self)->tp_free(self);\n"
18911917
"}"
18921918
msgstr ""
1919+
"static void\n"
1920+
"foo_dealloc(PyObject *op)\n"
1921+
"{\n"
1922+
" foo_object *self = (foo_object *) op;\n"
1923+
" PyObject_GC_UnTrack(self);\n"
1924+
" Py_CLEAR(self->ref);\n"
1925+
" Py_TYPE(self)->tp_free(self);\n"
1926+
"}"
18931927

18941928
#: ../../c-api/typeobj.rst:750
18951929
msgid ""
@@ -1898,6 +1932,8 @@ msgid ""
18981932
"must be backed up first and restored later (after logging any exceptions "
18991933
"with :c:func:`PyErr_WriteUnraisable`)."
19001934
msgstr ""
1935+
":c:member:`!tp_dealloc` 必须保持异常状态不变。如果它需要调用可能引发异常的函数,必须先备份异常状态,之后(在用 "
1936+
":c:func:`PyErr_WriteUnraisable` 记录任何异常后)再恢复该状态。"
19011937

19021938
#: ../../c-api/typeobj.rst:755
19031939
msgid "Example::"
@@ -1944,6 +1980,44 @@ msgid ""
19441980
" PyErr_SetRaisedException(exc);\n"
19451981
"}"
19461982
msgstr ""
1983+
"static void\n"
1984+
"foo_dealloc(PyObject *self)\n"
1985+
"{\n"
1986+
" PyObject *exc = PyErr_GetRaisedException();\n"
1987+
"\n"
1988+
" if (PyObject_CallFinalizerFromDealloc(self) < 0) {\n"
1989+
" // 自我复活了。\n"
1990+
" goto done;\n"
1991+
" }\n"
1992+
"\n"
1993+
" PyTypeObject *tp = Py_TYPE(self);\n"
1994+
"\n"
1995+
" if (tp->tp_flags & Py_TPFLAGS_HAVE_GC) {\n"
1996+
" PyObject_GC_UnTrack(self);\n"
1997+
" }\n"
1998+
"\n"
1999+
" // 可选,但可以避免代码重复,较为方便。\n"
2000+
" if (tp->tp_clear && tp->tp_clear(self) < 0) {\n"
2001+
" PyErr_WriteUnraisable(self);\n"
2002+
" }\n"
2003+
"\n"
2004+
" // 此处可执行任何额外的销毁操作。\n"
2005+
"\n"
2006+
" tp->tp_free(self);\n"
2007+
" self = NULL; // 若后续调用了 PyErr_WriteUnraisable() 函数。\n"
2008+
"\n"
2009+
" if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n"
2010+
" Py_CLEAR(tp);\n"
2011+
" }\n"
2012+
"\n"
2013+
"done:\n"
2014+
" // 可选操作:若之前调用的操作可能引发了异常。\n"
2015+
" // \n"
2016+
" if (PyErr_Occurred()) {\n"
2017+
" PyErr_WriteUnraisable(self);\n"
2018+
" }\n"
2019+
" PyErr_SetRaisedException(exc);\n"
2020+
"}"
19472021

19482022
#: ../../c-api/typeobj.rst:796
19492023
msgid ""
@@ -1957,12 +2031,17 @@ msgid ""
19572031
"objects on the thread which called :c:member:`!tp_dealloc` will not violate "
19582032
"any assumptions of the library."
19592033
msgstr ""
2034+
":c:member:`!tp_dealloc` 可能从任意 Python "
2035+
"线程调用,而不仅限于创建该对象的线程(如果对象成为引用循环的一部分,该循环可能由任意线程的垃圾回收操作回收)。 这对 Python API "
2036+
"调用不是问题,因为调用 :c:member:`!tp_dealloc` 的线程会带有 :term:`attached thread "
2037+
"state`。然而,如果被销毁的对象反过来会销毁其他 C 库中的对象,则需要确保在调用 :c:member:`!tp_dealloc` "
2038+
"的线程上销毁这些对象不会违反该库的任何假设条件。"
19602039

19612040
#: ../../c-api/typeobj.rst:814 ../../c-api/typeobj.rst:1714
19622041
#: ../../c-api/typeobj.rst:2447
19632042
msgid ""
19642043
":ref:`life-cycle` for details about how this slot relates to other slots."
1965-
msgstr ""
2044+
msgstr "有关此槽位如何与其他槽位关联的详细信息,请参阅 :ref:`life-cycle`。"
19662045

19672046
#: ../../c-api/typeobj.rst:819
19682047
msgid ""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy