8000 Translate `c-api/refcounting.po` by mattwang44 · Pull Request #559 · python/python-docs-zh-tw · GitHub
[go: up one dir, main page]

Skip to content

Translate c-api/refcounting.po #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 21 additions & 24 deletions c-api/refcounting.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-24 00:03+0000\n"
"PO-Revision-Date: 2023-07-01 14:19+0800\n"
"PO-Revision-Date: 2023-08-06 14:19+0800\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
Expand Down Expand Up @@ -37,15 +37,15 @@ msgstr "取得物件 *o* 的參照計數。"
#: ../../c-api/refcounting.rst:18
msgid ""
"Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count."
msgstr ""
msgstr "使用 :c:func:`Py_SET_REFCNT()` 函式設定物件參照計數。"

#: ../../c-api/refcounting.rst:20
msgid "The parameter type is no longer :c:expr:`const PyObject*`."
msgstr ""
msgstr "參數型別不再是 :c:expr:`const PyObject*`。"

#: ../../c-api/refcounting.rst:23
msgid ":c:func:`Py_REFCNT()` is changed to the inline static function."
msgstr ""
msgstr ":c:func:`Py_REFCNT()` 更改為行內靜態函式 (inline static function)。"

#: ../../c-api/refcounting.rst:29
msgid "Set the object *o* reference counter to *refcnt*."
Expand Down Expand Up @@ -124,7 +124,7 @@ msgstr ""

#: ../../c-api/refcounting.rst:74
msgid "See also :c:func:`Py_INCREF`."
msgstr "另請參閱 :c:func:`Py_INCREF`\\ 。"
msgstr "另請參閱 :c:func:`Py_INCREF`。"

#: ../../c-api/refcounting.rst:81
msgid "Similar to :c:func:`Py_NewRef`, but the object *o* can be NULL."
Expand Down Expand Up @@ -173,12 +173,12 @@ msgid ""
"object in a temporary variable, update the list data structure, and then "
"call :c:func:`Py_DECREF` for the temporary variable."
msgstr ""
"釋放函式可以導致任意 Python 程式碼被調用(例如,當釋放具有 :meth:`~object.__del__` 方"
"法的類別實例時)。雖然此類程式碼中的例外不會被傳遞出來,但​​執行的程式碼可以自"
"由存取所有 Python 全域變數。這意味著在調用 :c:func:`Py_DECREF` 之前,可從全域"
"變數存取的任何物件都應處於一致狀態。例如,從 list 中刪除物件的程式碼應將已刪"
"除物件的參照複製到臨時變數中,更新 list 資料結構,然後為臨時變數呼叫 :c:func:"
"`Py_DECREF`。"
"釋放函式可以導致任意 Python 程式碼被調用(例如,當釋放具有 :meth:`~object."
"__del__` 方法的類別實例時)。雖然此類程式碼中的例外不會被傳遞出來,但​​執行的程"
"式碼可以自由存取所有 Python 全域變數。這意味著在調用 :c:func:`Py_DECREF` "
"前,可從全域變數存取的任何物件都應處於一致狀態。例如,從 list 中刪除物件的程"
"式碼應將已刪除物件的參照複製到臨時變數中,更新 list 資料結構,然後為臨時變數"
"呼叫 :c:func:`Py_DECREF`。"

#: ../../c-api/refcounting.rst:115
msgid ""
Expand Down Expand Up @@ -215,6 +215,8 @@ msgid ""
"The macro argument is now only evaluated once. If the argument has side "
"effects, these are no longer duplicated."
msgstr ""
"巨集引數現在僅會被求值 (evaluate) 一次。如果引數有其他副作用,則不再重複作"
"用。"

#: ../../c-api/refcounting.rst:139
msgid ""
Expand All @@ -236,40 +238,35 @@ msgstr ""
msgid ""
"Macro safely decrementing the `dst` reference count and setting `dst` to "
"`src`."
msgstr ""
msgstr "巨集安全地減少 `dst` 參照計數並將 `dst` 設定為 `src`。"

#: ../../c-api/refcounting.rst:154
msgid "As in case of :c:func:`Py_CLEAR`, \"the obvious\" code can be deadly::"
msgstr ""
msgstr "與 :c:func:`Py_CLEAR` 的情況一樣,「明顯的」程式碼可能是致命的: ::"

#: ../../c-api/refcounting.rst:159
msgid "The safe way is::"
msgstr ""
msgstr "安全的方法是: ::"

#: ../../c-api/refcounting.rst:163
msgid ""
"That arranges to set `dst` to `src` _before_ decrementing reference count of "
"*dst* old value, so that any code triggered as a side-effect of `dst` "
"getting torn down no longer believes `dst` points to a valid object."
msgstr ""
"這會在減少 `dst` 舊值的參照計數\\ _之前_\\ 將 `dst` 設定為 `src`,使得因 "
"`dst` 被拆除而觸發的任何程式碼不會相信 `dst` 有指向一個有效物件。"
Copy link
Collaborator
@rockleona rockleona Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這句好難喔@@
我修改了一下語句看有沒有比較通順

Suggested change
"這會在減少 `dst` 舊值的參照計數\\ _之前_\\ 將 `dst` 設定為 `src`,使得因 "
"`dst` 被拆除而觸發的任何程式碼不會相信 `dst` 有指向一個有效物件。"
"這會在減少 `dst` 舊值的參照計數\\ _之前_\\ 將 `dst` 設定為 `src`,使得任何程式碼 "
"觸發了 `dst` 被拆除的副作用 (side-effect) 進而不會相信 `dst` 有指向一個有效物件。"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • code 指的應該是被意外觸發的部分(也就是 side effect)
  • 我漏翻 side effect

如果改成這樣呢?

Suggested change
"這會在減少 `dst` 舊值的參照計數\\ _之前_\\ 將 `dst` 設定為 `src`,使得因 "
"`dst` 被拆除而觸發的任何程式碼不會相信 `dst` 有指向一個有效物件。"
"這會在減少 `dst` 舊值的參照計數\\ _之前_\\ 將 `dst` 設定為 `src`,使得因 "
"`dst` 被拆除而觸發的任何副作用 (side-effect) 之程式碼不會相信 `dst` 是"
"指向一個有效物件。"


#: ../../c-api/refcounting.rst:169 ../../c-api/refcounting.rst:181
msgid ""
"The macro arguments are now only evaluated once. If an argument has side "
"effects, these are no longer duplicated."
msgstr ""
msgstr "巨集引數現在僅會被求值一次。如果引數有其他副作用,則不再重複作用。"

#: ../../c-api/refcounting.rst:176
msgid ""
"Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead "
"of :c:func:`Py_DECREF`."
msgstr ""

#~ msgid ""
#~ "The following functions or macros are only for use within the interpreter "
#~ "core: :c:func:`_Py_Dealloc`, :c:func:`_Py_ForgetReference`, :c:func:"
#~ "`_Py_NewReference`, as well as the global variable :c:data:`_Py_RefTotal`."
#~ msgstr ""
#~ "以下函式或巨集僅在直譯器核心內使用::c:func:`_Py_Dealloc`、:c:func:"
#~ "`_Py_ForgetReference`、:c:func:`_Py_NewReference` 以及全域變數 :c:data:"
#~ "`_Py_RefTotal`。"
":c:macro:`Py_SETREF` 巨集的變體,請改用 :c:func:`Py_XDECREF` 而非 :c:func:"
"`Py_DECREF`。"
0