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

Skip to content

Commit cc5597f

Browse files
Sync with CPython 3.13 (#1041)
1 parent 90fc0c3 commit cc5597f

File tree

11 files changed

+952
-866
lines changed

11 files changed

+952
-866
lines changed

c-api/stable.po

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ msgstr ""
3737
#: ../../c-api/stable.rst:15
3838
msgid ""
3939
"CPython's Application Binary Interface (ABI) is forward- and backwards-"
40-
"compatible across a minor release (if these are compiled the same way; see :"
41-
"ref:`stable-abi-platform` below). So, code compiled for Python 3.10.0 will "
42-
"work on 3.10.8 and vice versa, but will need to be compiled separately for "
43-
"3.9.x and 3.11.x."
40+
"compatible across a minor release (if these are compiled the same way; "
41+
"see :ref:`stable-abi-platform` below). So, code compiled for Python 3.10.0 "
42+
"will work on 3.10.8 and vice versa, but will need to be compiled separately "
43+
"for 3.9.x and 3.11.x."
4444
msgstr ""
4545
"CPython 的應用程式二進位介面 (Application Binary Interface, ABI) 在次要版本中"
4646
"是向前和向後相容的(如果它們以相同的方式編譯;請參閱下面的\\ :ref:`stable-"
@@ -65,8 +65,8 @@ msgid ""
6565
"releases. When :c:macro:`Py_LIMITED_API` is defined, only this subset is "
6666
"exposed from ``Python.h``."
6767
msgstr ""
68-
":ref:`受限 API <limited-c-api>`,在多個次要版本之間相容。當有定義 :c:macro:"
69-
"`Py_LIMITED_API` 時,只有這個子集會從 ``Python.h`` 公開。"
68+
":ref:`受限 API <limited-c-api>`,在多個次要版本之間相容。當有定"
69+
"義 :c:macro:`Py_LIMITED_API` 時,只有這個子集會從 ``Python.h`` 公開。"
7070

7171
#: ../../c-api/stable.rst:29
7272
msgid "These are discussed in more detail below."
@@ -76,14 +76,14 @@ msgstr "下面將更詳細地討論這些內容。"
7676
msgid ""
7777
"Names prefixed by an underscore, such as ``_Py_InternalState``, are private "
7878
"API that can change without notice even in patch releases. If you need to "
79-
"use this API, consider reaching out to `CPython developers <https://discuss."
80-
"python.org/c/core-dev/c-api/30>`_ to discuss adding public API for your use "
81-
"case."
79+
"use this API, consider reaching out to `CPython developers <https://"
80+
"discuss.python.org/c/core-dev/c-api/30>`_ to discuss adding public API for "
81+
"your use case."
8282
msgstr ""
8383
"帶有底線前綴的名稱是私有 API (private API),像是 ``_Py_InternalState``,即使"
8484
"在補丁版本 (patch release) 中也可能被更改,不會另行通知。如果你需要使用這個 "
85-
"API,可以聯繫 `CPython 開發者 <https://discuss.python.org/c/core-dev/c-"
86-
"api/30>`_ 並針對你的使用方法來討論是否新增公開的 API。"
85+
"API,可以聯繫 `CPython 開發者 <https://discuss.python.org/c/core-dev/c-api/"
86+
"30>`_ 並針對你的使用方法來討論是否新增公開的 API。"
8787

8888
#: ../../c-api/stable.rst:40
8989
msgid "Unstable C API"
@@ -156,9 +156,9 @@ msgid ""
156156
"extension will be ABI-compatible with all Python 3 releases from the "
157157
"specified one onward, and can use Limited API introduced up to that version."
158158
msgstr ""
159-
"將 ``Py_LIMITED_API`` 定義為對應於你的擴充有支援的最低 Python 版本的 :c:"
160-
"macro:`PY_VERSION_HEX` 值。該擴充與從指定版本開始的所有 Python 3 版本之 ABI "
161-
"相容,並且可以使用過去版本有引入的受限 API。"
159+
"將 ``Py_LIMITED_API`` 定義為對應於你的擴充有支援的最低 Python 版本"
160+
"的 :c:macro:`PY_VERSION_HEX` 值。該擴充與從指定版本開始的所有 Python 3 版本"
161+
"之 ABI 相容,並且可以使用過去版本有引入的受限 API。"
162162

163163
#: ../../c-api/stable.rst:83
164164
msgid ""
@@ -211,8 +211,8 @@ msgstr ""
211211
#: ../../c-api/stable.rst:111
212212
msgid ""
213213
"On Windows, extensions that use the Stable ABI should be linked against "
214-
"``python3.dll`` rather than a version-specific library such as ``python39."
215-
"dll``."
214+
"``python3.dll`` rather than a version-specific library such as "
215+
"``python39.dll``."
216216
msgstr ""
217217
"在 Windows 上,使用穩定 ABI 的擴充應該連接到 ``python3.dll`` 而不是特定版本的"
218218
"函式庫,例如 ``python39.dll``。"
@@ -256,9 +256,9 @@ msgid ""
256256
"variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because it "
257257
"can rely on version-specific implementation details of the list object."
258258
msgstr ""
259-
"例如,雖然 :c:func:`PyList_GetItem` 可用,但它的「不安全」巨集變體 :c:func:"
260-
"`PyList_GET_ITEM` 為不可用。巨集運行可以更快,因為它可以依賴 list 物件的特定"
261-
"版本實作細節。"
259+
"例如,雖然 :c:func:`PyList_GetItem` 可用,但它的「不安全」巨集變"
260+
"體 :c:func:`PyList_GET_ITEM` 為不可用。巨集運行可以更快,因為它可以依賴 list "
261+
"物件的特定版本實作細節。"
262262

263263
#: ../../c-api/stable.rst:138
264264
msgid ""
@@ -280,7 +280,7 @@ msgid ""
280280
"where a version-specific one is not available – for example, for prereleases "
281281
"of an upcoming Python version."
282282
msgstr ""
283-
"通過省略 ``Py_LIMITED_API`` 定義,可以使用特定版本的 ABI 編譯受限 API 擴充。"
283+
"透過省略 ``Py_LIMITED_API`` 定義,可以使用特定版本的 ABI 編譯受限 API 擴充。"
284284
"這可以提高該 Python 版本的性能,但會限制相容性。使用 ``Py_LIMITED_API`` 編譯"
285285
"將產生一個擴充,可以在特定版本的擴充不可用的地方發布 — 例如,用於即將發布的 "
286286
"Python 版本的預發布版本 (prerelease)。"
@@ -292,9 +292,10 @@ msgstr "受限 API 注意事項"
292292
#: ../../c-api/stable.rst:154
293293
msgid ""
294294
"Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee "
295-
"that code conforms to the :ref:`Limited API <limited-c-api>` or the :ref:"
296-
"`Stable ABI <stable-abi>`. ``Py_LIMITED_API`` only covers definitions, but "
297-
"an API also includes other issues, such as expected semantics."
295+
"that code conforms to the :ref:`Limited API <limited-c-api>` or "
296+
"the :ref:`Stable ABI <stable-abi>`. ``Py_LIMITED_API`` only covers "
297+
"definitions, but an API also includes other issues, such as expected "
298+
"semantics."
298299
msgstr ""
299300
"請注意,使用 ``Py_LIMITED_API`` 進行編譯\\ *不*\\ 完全保證程式碼符合\\ :ref:`"
300301
"受限 API <limited-c-api>` 或\\ :ref:`穩定 ABI <stable-abi>`。"
@@ -361,9 +362,9 @@ msgstr "平台注意事項"
361362
#: ../../c-api/stable.rst:189
362363
msgid ""
363364
"ABI stability depends not only on Python, but also on the compiler used, "
364-
"lower-level libraries and compiler options. For the purposes of the :ref:"
365-
"`Stable ABI <stable-abi>`, these details define a “platform”. They usually "
366-
"depend on the OS type and processor architecture"
365+
"lower-level libraries and compiler options. For the purposes of "
366+
"the :ref:`Stable ABI <stable-abi>`, these details define a “platform”. They "
367+
"usually depend on the OS type and processor architecture"
367368
msgstr ""
368369
"ABI 穩定性不僅取決於 Python,還取決於使用的編譯器、低階函式庫和編譯器選項。出"
369370
"於\\ :ref:`穩定 ABI <stable-abi>` 的目的,這些細節定義了一個「平台」。它們通"

faq/extending.po

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ msgstr "我可以在 C 中建立自己的函式嗎?"
3434
#: ../../faq/extending.rst:18
3535
msgid ""
3636
"Yes, you can create built-in modules containing functions, variables, "
37-
"exceptions and even new types in C. This is explained in the document :ref:"
38-
"`extending-index`."
37+
"exceptions and even new types in C. This is explained in the "
38+
"document :ref:`extending-index`."
3939
msgstr ""
40-
"是的,你可以在 C 中建立包含函式、變數、例外甚至新型別的內建模組,:ref:"
41-
"`extending-index` 文件中有相關說明。"
40+
"是的,你可以在 C 中建立包含函式、變數、例外甚至新型別的內建模"
41+
"組,:ref:`extending-index` 文件中有相關說明。"
4242

4343
#: ../../faq/extending.rst:22
4444
msgid "Most intermediate or advanced Python books will also cover this topic."
@@ -73,16 +73,16 @@ msgstr "要編寫你自己的 C 擴充有許多替代方法,取決於你要執
7373
#: ../../faq/extending.rst:44
7474
#, fuzzy
7575
msgid ""
76-
"`Cython <https://cython.org>`_ and its relative `Pyrex <https://www.csse."
77-
"canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ are compilers that accept a "
78-
"slightly modified form of Python and generate the corresponding C code. "
79-
"Cython and Pyrex make it possible to write an extension without having to "
80-
"learn Python's C API."
76+
"`Cython <https://cython.org>`_ and its relative `Pyrex <https://"
77+
"www.csse.canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ are compilers that "
78+
"accept a slightly modified form of Python and generate the corresponding C "
79+
"code. Cython and Pyrex make it possible to write an extension without "
80+
"having to learn Python's C API."
8181
msgstr ""
82-
"`Cython <https://cython.org>`_ 及其相關的 `Pyrex <https://www.csse."
83-
"canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ 是接受稍微修改 Python 形式並生成"
84-
"相應的 C 程式碼。 Cython 和 Pyrex 使編寫擴充程式成為可能,而無需學習 Python "
85-
"的 C API。"
82+
"`Cython <https://cython.org>`_ 及其相關的 `Pyrex <https://"
83+
"www.csse.canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ 是接受稍微修改 Python "
84+
"形式並生成相應的 C 程式碼。 Cython 和 Pyrex 使編寫擴充程式成為可能,而無需學"
85+
"習 Python 的 C API。"
8686

8787
#: ../../faq/extending.rst:50
8888
#, fuzzy
@@ -111,15 +111,15 @@ msgid ""
111111
"The highest-level function to do this is :c:func:`PyRun_SimpleString` which "
112112
"takes a single string argument to be executed in the context of the module "
113113
"``__main__`` and returns ``0`` for success and ``-1`` when an exception "
114-
"occurred (including :exc:`SyntaxError`). If you want more control, use :c:"
115-
"func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in "
116-
"``Python/pythonrun.c``."
114+
"occurred (including :exc:`SyntaxError`). If you want more control, "
115+
"use :c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` "
116+
"in ``Python/pythonrun.c``."
117117
msgstr ""
118118
"執行此操作的最高級別函式是 :c:func:`PyRun_SimpleString`,它採用單個字串引數在"
119119
"模組 ``__main__`` 的上下文中執行,並回傳 ``0`` 表示成功,``- 1`` 發生例外時"
120-
"(包括 :exc:`SyntaxError`)。如果你想要更多的控制,使用 :c:func:"
121-
"`PyRun_String`;在 ``Python/pythonrun.c`` 中查看 :c:func:"
122-
"`PyRun_SimpleString` 的原始碼。"
120+
"(包括 :exc:`SyntaxError`)。如果你想要更多的控制,使"
121+
"用 :c:func:`PyRun_String`;在 ``Python/pythonrun.c`` 中查"
122+
"看 :c:func:`PyRun_SimpleString` 的原始碼。"
123123

124124
#: ../../faq/extending.rst:72
125125
#, fuzzy
@@ -133,8 +133,8 @@ msgid ""
133133
"start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it "
134134
"and returns its value."
135135
msgstr ""
136-
"呼叫上一個問題中的函式 :c:func:`PyRun_String` 開始符號 :c:data:"
137-
"`Py_eval_input`;它解析一個運算式,對其求值並回傳它的值。"
136+
"呼叫上一個問題中的函式 :c:func:`PyRun_String` 開始符"
137+
"號 :c:data:`Py_eval_input`;它解析一個運算式,對其求值並回傳它的值。"
138138

139139
#: ../../faq/extending.rst:80
140140
msgid "How do I extract C values from a Python object?"
@@ -145,33 +145,34 @@ msgstr "如何從 Python 物件中提取 C 值?"
145145
msgid ""
146146
"That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` "
147147
"returns its length and :c:func:`PyTuple_GetItem` returns the item at a "
148-
"specified index. Lists have similar functions, :c:func:`PyList_Size` and :c:"
149-
"func:`PyList_GetItem`."
148+
"specified index. Lists have similar functions, :c:func:`PyList_Size` "
149+
"and :c:func:`PyList_GetItem`."
150150
msgstr ""
151-
"這取決於物件的型別。如果它是一個元組,:c:func:`PyTuple_Size` 回傳它的長度,:"
152-
"c:func:`PyTuple_GetItem` 回傳指定索引的項目。列表具有類似的函式:c:func:"
153-
"`PyList_Size` 和 :c:func:`PyList_GetItem`。"
151+
"這取決於物件的型別。如果它是一個元組,:c:func:`PyTuple_Size` 回傳它的長"
152+
"度,:c:func:`PyTuple_GetItem` 回傳指定索引的項目。列表具有類似的函式:"
153+
"c:func:`PyList_Size` 和 :c:func:`PyList_GetItem`。"
154154

155155
#: ../../faq/extending.rst:87
156156
#, fuzzy
157157
msgid ""
158-
"For bytes, :c:func:`PyBytes_Size` returns its length and :c:func:"
159-
"`PyBytes_AsStringAndSize` provides a pointer to its value and its length. "
160-
"Note that Python bytes objects may contain null bytes so C's :c:func:`!"
161-
"strlen` should not be used."
158+
"For bytes, :c:func:`PyBytes_Size` returns its length "
159+
"and :c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and "
160+
"its length. Note that Python bytes objects may contain null bytes so "
161+
"C's :c:func:`!strlen` should not be used."
162162
msgstr ""
163-
"對於位元組,:c:func:`PyBytes_Size` 回傳它的長度,:c:func:"
164-
"`PyBytes_AsStringAndSize` 提供指向它的值和長度的指標。請注意,Python 位元組物"
165-
"件可能包含空位元組,因此不應使用 C 的 :c:func:`!strlen`。"
163+
"對於位元組,:c:func:`PyBytes_Size` 回傳它的長"
164+
"度,:c:func:`PyBytes_AsStringAndSize` 提供指向它的值和長度的指標。請注意,"
165+
"Python 位元組物件可能包含空位元組,因此不應使用 C 的 :c:func:`!strlen`。"
166166

167167
#: ../../faq/extending.rst:92
168168
msgid ""
169169
"To test the type of an object, first make sure it isn't ``NULL``, and then "
170-
"use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:"
171-
"`PyList_Check`, etc."
170+
"use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, "
171+
"etc."
172172
msgstr ""
173-
"要測試物件的型別,首先確保它不是 ``NULL``,然後再使用 :c:func:"
174-
"`PyBytes_Check`、:c:func:`PyTuple_Check`、:c:func:`PyList_Check` 等函式。"
173+
"要測試物件的型別,首先確保它不是 ``NULL``,然後再使"
174+
"用 :c:func:`PyBytes_Check`、:c:func:`PyTuple_Check`、:c:func:`PyList_Check` "
175+
"等函式。"
175176

176177
#: ../../faq/extending.rst:95
177178
#, fuzzy
@@ -184,9 +185,10 @@ msgid ""
184185
"al.) and mappings in the PyMapping APIs."
185186
msgstr ""
186187
"還有一個針對 Python 物件的高級 API,它由所謂的「抽象」介面提供——閱讀 "
187-
"``Include/abstract.h`` 了解更多詳細資訊。它允許使用 :c:func:"
188-
"`PySequence_Length`、:c:func:`PySequence_GetItem` 等呼叫以及許多其他有用的協"
189-
"議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的對映。"
188+
"``Include/abstract.h`` 了解更多詳細資訊。它允許使"
189+
"用 :c:func:`PySequence_Length`、:c:func:`PySequence_GetItem` 等呼叫以及許多其"
190+
"他有用的協議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的"
191+
"對映。"
190192

191193
#: ../../faq/extending.rst:104
192194
msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?"
@@ -229,8 +231,8 @@ msgid ""
229231
"defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the "
230232
"return value."
231233
msgstr ""
232-
"這適用於任何具有方法的物件——無論是內建的還是使用者定義的。你負責最終 :c:func:"
233-
"`Py_DECREF`\\ 'ing 回傳值。"
234+
"這適用於任何具有方法的物件——無論是內建的還是使用者定義的。你負責最"
235+
"終 :c:func:`Py_DECREF`\\ 'ing 回傳值。"
234236

235237
#: ../../faq/extending.rst:124
236238
msgid ""
@@ -277,9 +279,9 @@ msgid ""
277279
"print_error, or just allow the standard traceback mechanism to work. Then, "
278280
"the output will go wherever your ``write()`` method sends it."
279281
msgstr ""
280-
"在 Python 程式碼中,定義一個支援 ``write()`` 方法的物件。將此物件分配給 :"
281-
"data:`sys.stdout` 和 :data:`sys.stderr`。呼叫 print_error,或者只允許標準的回"
282-
"溯機制起作用。然後,輸出將到達你的 ``write()`` 方法發送它的任何地方。"
282+
"在 Python 程式碼中,定義一個支援 ``write()`` 方法的物件。將此物件分配"
283+
"給 :data:`sys.stdout` 和 :data:`sys.stderr`。呼叫 print_error,或者只允許標準"
284+
"的回溯機制起作用。然後,輸出將到達你的 ``write()`` 方法發送它的任何地方。"
283285

284286
#: ../../faq/extending.rst:149
285287
msgid "The easiest way to do this is to use the :class:`io.StringIO` class:"
@@ -356,11 +358,11 @@ msgstr "module = PyImport_ImportModule(\"<modulename>\");"
356358
#: ../../faq/extending.rst:188
357359
#, fuzzy
358360
msgid ""
359-
"If the module hasn't been imported yet (i.e. it is not yet present in :data:"
360-
"`sys.modules`), this initializes the module; otherwise it simply returns the "
361-
"value of ``sys.modules[\"<modulename>\"]``. Note that it doesn't enter the "
362-
"module into any namespace -- it only ensures it has been initialized and is "
363-
"stored in :data:`sys.modules`."
361+
"If the module hasn't been imported yet (i.e. it is not yet present "
362+
"in :data:`sys.modules`), this initializes the module; otherwise it simply "
363+
"returns the value of ``sys.modules[\"<modulename>\"]``. Note that it "
364+
"doesn't enter the module into any namespace -- it only ensures it has been "
365+
"initialized and is stored in :data:`sys.modules`."
364366
msgstr ""
365367
"如果模組還沒有被引入(即它還沒有出現在 :data:`sys.modules` 中),這會初始化模"
366368
"組;否則它只回傳 ``sys.modules[\"<modulename>\"]`` 的值。請注意,它不會將模組"
@@ -516,9 +518,9 @@ msgid ""
516518
"``Parser/myreadline.c`` for more hints."
517519
msgstr ""
518520
"在 C 中執行此操作的最簡單方法是呼叫:c:func:`PyRun_InteractiveLoop`(可能在單"
519-
"獨的執行緒中)並讓 Python 直譯器為你處理輸入。你還可以將 :c:func:"
520-
"`PyOS_ReadlineFunctionPointer` 設定為指向你的自定義輸入函式。有關更多提示,請"
521-
"參閱``Modules/readline.c`` 和``Parser/myreadline.c``。"
521+
"獨的執行緒中)並讓 Python 直譯器為你處理輸入。你還可以"
522+
"將 :c:func:`PyOS_ReadlineFunctionPointer` 設定為指向你的自定義輸入函式。有關"
523+
"更多提示,請參閱``Modules/readline.c`` 和``Parser/myreadline.c``。"
522524

523525
#: ../../faq/extending.rst:275
524526
msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?"
@@ -541,22 +543,22 @@ msgid ""
541543
"Can I create an object class with some methods implemented in C and others "
542544
"in Python (e.g. through inheritance)?"
543545
msgstr ""
544-
"我可以用一些用 C 實作的方法和用 Python 實作的其他方法(例如通過繼承)建立一個"
546+
"我可以用一些用 C 實作的方法和用 Python 實作的其他方法(例如透過繼承)建立一個"
545547
"物件類別嗎?"
546548

547549
#: ../../faq/extending.rst:285
548550
msgid ""
549-
"Yes, you can inherit from built-in classes such as :class:`int`, :class:"
550-
"`list`, :class:`dict`, etc."
551+
"Yes, you can inherit from built-in classes such "
552+
"as :class:`int`, :class:`list`, :class:`dict`, etc."
551553
msgstr ""
552554
"是的,你可以繼承內建類別,例如 :class:`int`、:class:`list`、:class:`dict` "
553555
"等。"
554556

555557
#: ../../faq/extending.rst:288
556558
msgid ""
557-
"The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/index."
558-
"html) provides a way of doing this from C++ (i.e. you can inherit from an "
559-
"extension class written in C++ using the BPL)."
559+
"The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/"
560+
"index.html) provides a way of doing this from C++ (i.e. you can inherit from "
561+
"an extension class written in C++ using the BPL)."
560562
msgstr ""
561563
"Boost Python 函式庫(BPL,https://www.boost.org/libs/python/doc/index.html)"
562564
"提供了一種從 C++ 執行此操作的方法(即你可以使用 BPL 來繼承用 C++ 編寫的擴充類"

0 commit comments

Comments
 (0)