-
-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathstable.po
More file actions
301 lines (266 loc) · 14.8 KB
/
Copy pathstable.po
File metadata and controls
301 lines (266 loc) · 14.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2025, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# python-doc bot, 2025
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.11\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-03 15:28+0000\n"
"PO-Revision-Date: 2025-09-22 16:49+0000\n"
"Last-Translator: python-doc bot, 2025\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../c-api/stable.rst:7
msgid "C API Stability"
msgstr "C API 的稳定性"
#: ../../c-api/stable.rst:9
msgid ""
"Python's C API is covered by the Backwards Compatibility Policy, :pep:`387`."
" While the C API will change with every minor release (e.g. from 3.9 to "
"3.10), most changes will be source-compatible, typically by only adding new "
"API. Changing existing API or removing API is only done after a deprecation "
"period or to fix serious issues."
msgstr ""
"Python 的 C 语言 API 包含于向下兼容政策 :pep:`387` 中。C API 会跟随小版本的发布而发生变化(比如 3.9 到 3.10 "
"的时候),不过大多数变化都是源代码级兼容的,通常只会增加新的 API。已有 API 的修改或删除,只有在废止期过后或修复严重问题时才会进行。"
#: ../../c-api/stable.rst:15
msgid ""
"CPython's Application Binary Interface (ABI) is forward- and backwards-"
"compatible across a minor release (if these are compiled the same way; see "
":ref:`stable-abi-platform` below). So, code compiled for Python 3.10.0 will "
"work on 3.10.8 and vice versa, but will need to be compiled separately for "
"3.9.x and 3.11.x."
msgstr ""
"CPython 的应用程序二进制接口(ABI)可以跨微版本向上和向下兼容(在以相同方式编译的情况下,参见下文 :ref:`stable-abi-"
"platform` 一节)。 因此,针对 Python 3.10.0 编译的代码将适用于 3.10.8,反之亦然,但对于 3.9.x 和 3.11.x "
"则需要单独编译。"
#: ../../c-api/stable.rst:21
msgid ""
"Names prefixed by an underscore, such as ``_Py_InternalState``, are private "
"API that can change without notice even in patch releases."
msgstr "带下划线前缀的是私有 API,如 ``_Py_InternalState``,即便是补丁发布版本中也可能不加通知地进行改动。"
#: ../../c-api/stable.rst:26
msgid "Stable Application Binary Interface"
msgstr "应用程序二进制接口的稳定版"
#: ../../c-api/stable.rst:28
msgid ""
"For simplicity, this document talks about *extensions*, but the Limited API "
"and Stable ABI work the same way for all uses of the API – for example, "
"embedding Python."
msgstr ""
"简单起见,本文档只讨论了 *扩展*,但受限 API 和稳定 ABI 对于 API 的所有用法都能发挥相同的作用 – 例如嵌入版的 Python 等。"
#: ../../c-api/stable.rst:35
msgid "Limited C API"
msgstr "受限 C API"
#: ../../c-api/stable.rst:37
msgid ""
"Python 3.2 introduced the *Limited API*, a subset of Python's C API. "
"Extensions that only use the Limited API can be compiled once and work with "
"multiple versions of Python. Contents of the Limited API are :ref:`listed "
"below <limited-api-list>`."
msgstr ""
"Python 3.2 引入了 *受限 API*,它是 Python 的 C API 的一个子集。 只使用受限 API 扩展可以一次编译即适用于多个 "
"Python 版本。 受限 API 的内容 :ref:`如下所示 <limited-api-list>`。"
#: ../../c-api/stable.rst:44
msgid ""
"Define this macro before including ``Python.h`` to opt in to only use the "
"Limited API, and to select the Limited API version."
msgstr "请在包括 ``Python.h`` 之前定义这个宏以选择只使用受限 API,并选择受限 API 的版本。"
#: ../../c-api/stable.rst:47
msgid ""
"Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX` "
"corresponding to the lowest Python version your extension supports. The "
"extension will work without recompilation with all Python 3 releases from "
"the specified one onward, and can use Limited API introduced up to that "
"version."
msgstr ""
"将 ``Py_LIMITED_API`` 定义为与你的扩展所支持的最低 Python 版本的 :c:macro:`PY_VERSION_HEX` 的值。"
" 扩展将无需重编译即可适用于从该指定版本开始的所有 Python 3 发布版,并可使用到该版本为止所引入的受限 API。"
#: ../../c-api/stable.rst:53
msgid ""
"Rather than using the ``PY_VERSION_HEX`` macro directly, hardcode a minimum "
"minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when "
"compiling with future Python versions."
msgstr ""
"不直接使用 ``PY_VERSION_HEX`` 宏,而是碍编码一个最小的次要版本(例如 ``0x030A0000`` 表示 Python "
"3.10)以便在使用未来的 Python 版本进行编译时保持稳定。"
#: ../../c-api/stable.rst:57
msgid ""
"You can also define ``Py_LIMITED_API`` to ``3``. This works the same as "
"``0x03020000`` (Python 3.2, the version that introduced Limited API)."
msgstr ""
"你还可以将 ``Py_LIMITED_API`` 定义为 ``3``。 其效果与 ``0x03020000`` 相同(即 Python 3.2,引入受限"
" API 的版本)。"
#: ../../c-api/stable.rst:64
msgid "Stable ABI"
msgstr "稳定 ABI"
#: ../../c-api/stable.rst:66
msgid ""
"To enable this, Python provides a *Stable ABI*: a set of symbols that will "
"remain compatible across Python 3.x versions."
msgstr "为启用此特性,Python 提供了一个 *稳定 ABI*: 将能跨 Python 3.x 版本保持兼容的一组符号。"
#: ../../c-api/stable.rst:69
msgid ""
"The Stable ABI contains symbols exposed in the :ref:`Limited API <limited-c-"
"api>`, but also other ones – for example, functions necessary to support "
"older versions of the Limited API."
msgstr ""
"稳定 ABI 包含在 :ref:`受限 API <limited-c-api>` 中对外公开的符号,但还包含其他符号 – 例如,为支持旧版本受限 API"
" 所需的函数。"
#: ../../c-api/stable.rst:73
msgid ""
"On Windows, extensions that use the Stable ABI should be linked against "
"``python3.dll`` rather than a version-specific library such as "
"``python39.dll``."
msgstr ""
"在 Windows 上,使用稳定 ABI 的扩展应当被链接到 ``python3.dll`` 而不是版本专属的库如 ``python39.dll``。"
#: ../../c-api/stable.rst:77
msgid ""
"On some platforms, Python will look for and load shared library files named "
"with the ``abi3`` tag (e.g. ``mymodule.abi3.so``). It does not check if such"
" extensions conform to a Stable ABI. The user (or their packaging tools) "
"need to ensure that, for example, extensions built with the 3.10+ Limited "
"API are not installed for lower versions of Python."
msgstr ""
"在某些平台上,Python 将查找并载入名称中带有 ``abi3`` 标签的共享库文件 (例如 ``mymodule.abi3.so``)。 "
"它不会检查这样的扩展是否兼容稳定 ABI。 使用方 (或其打包工具) 需要确保这一些,例如,基于 3.10+ 受限 API "
"编译的扩展不可被安装于更低版本的 Python 中。"
#: ../../c-api/stable.rst:84
msgid ""
"All functions in the Stable ABI are present as functions in Python's shared "
"library, not solely as macros. This makes them usable from languages that "
"don't use the C preprocessor."
msgstr ""
"稳定 ABI 中的所有函数都会作为 Python 的共享库中的函数存在,而不仅是作为宏。 这使得它们可以在不使用 C 预处理器的语言中使用。"
#: ../../c-api/stable.rst:90
msgid "Limited API Scope and Performance"
msgstr "受限 API 的作用域和性能"
#: ../../c-api/stable.rst:92
msgid ""
"The goal for the Limited API is to allow everything that is possible with "
"the full C API, but possibly with a performance penalty."
msgstr "受限 API 的目标是允许使用在完整 C API 中可用的任何东西,但可能会有性能上的损失。"
#: ../../c-api/stable.rst:95
msgid ""
"For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro"
" variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because "
"it can rely on version-specific implementation details of the list object."
msgstr ""
"例如,虽然 :c:func:`PyList_GetItem` 是可用的,但其 “不安全的” 宏版本 :c:func:`PyList_GET_ITEM` "
"则是不可用的。 这个宏的运行速度更快因为它可以利用版本专属的列表对象实现细节。"
#: ../../c-api/stable.rst:100
msgid ""
"Without ``Py_LIMITED_API`` defined, some C API functions are inlined or "
"replaced by macros. Defining ``Py_LIMITED_API`` disables this inlining, "
"allowing stability as Python's data structures are improved, but possibly "
"reducing performance."
msgstr ""
"在未定义 ``Py_LIMITED_API`` 的情况下,某些 C API 函数将由宏来执行内联或替换。 定义 ``Py_LIMITED_API`` "
"会禁用这样的内联,允许提升 Python 的数据结构稳定性,但有可能降低性能。"
#: ../../c-api/stable.rst:105
msgid ""
"By leaving out the ``Py_LIMITED_API`` definition, it is possible to compile "
"a Limited API extension with a version-specific ABI. This can improve "
"performance for that Python version, but will limit compatibility. Compiling"
" with ``Py_LIMITED_API`` will then yield an extension that can be "
"distributed where a version-specific one is not available – for example, for"
" prereleases of an upcoming Python version."
msgstr ""
"通过省略 ``Py_LIMITED_API`` 定义,可以使基于版本专属的 ABI 来编译受限 API 扩展成为可能。 这能提升其在相应 Python "
"版本上的性能,但也将限制其兼容性。 基于 ``Py_LIMITED_API`` 进行编译将产生一个可在版本专属扩展不可用的场合分发的扩展 – "
"例如,针对即将发布的 Python 版本的预发布包。"
#: ../../c-api/stable.rst:114
msgid "Limited API Caveats"
msgstr "受限 API 警示"
#: ../../c-api/stable.rst:116
msgid ""
"Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee "
"that code conforms to the :ref:`Limited API <limited-c-api>` or the "
":ref:`Stable ABI <stable-abi>`. ``Py_LIMITED_API`` only covers definitions, "
"but an API also includes other issues, such as expected semantics."
msgstr ""
"请注意使用 ``Py_LIMITED_API`` 进行编译 *无法* 完全保证代码能够兼容 :ref:`受限 API <limited-c-api>` "
"或 :ref:`稳定 ABI <stable-abi>`。 ``Py_LIMITED_API`` 仅仅涵盖定义部分,但一个 API "
"还包括其他因素,如预期的语义等。"
#: ../../c-api/stable.rst:121
msgid ""
"One issue that ``Py_LIMITED_API`` does not guard against is calling a "
"function with arguments that are invalid in a lower Python version. For "
"example, consider a function that starts accepting ``NULL`` for an argument."
" In Python 3.9, ``NULL`` now selects a default behavior, but in Python 3.8, "
"the argument will be used directly, causing a ``NULL`` dereference and "
"crash. A similar argument works for fields of structs."
msgstr ""
"``Py_LIMITED_API`` 不能处理的一个问题是附带在较低 Python 版本中无效的参数调用某个函数。 例如,考虑一个接受 ``NULL``"
" 作为参数的函数。 在 Python 3.9 中,``NULL`` 现在会选择一个默认行为,但在 Python 3.8 中,该参数将被直接使用,导致一个"
" ``NULL`` 引用被崩溃。 类似的参数也适用于结构体的字段。"
#: ../../c-api/stable.rst:128
msgid ""
"Another issue is that some struct fields are currently not hidden when "
"``Py_LIMITED_API`` is defined, even though they're part of the Limited API."
msgstr "另一个问题是当定义了 ``Py_LIMITED_API`` 时某些结构体字段目前不会被隐藏,即使它们是受限 API 的一部分。"
#: ../../c-api/stable.rst:131
msgid ""
"For these reasons, we recommend testing an extension with *all* minor Python"
" versions it supports, and preferably to build with the *lowest* such "
"version."
msgstr "出于这些原因,我们建议用要支持的 *所有* Python 小版本号来测试一个扩展,并最好是用其中 *最低* 的版本来编译它。"
#: ../../c-api/stable.rst:134
msgid ""
"We also recommend reviewing documentation of all used API to check if it is "
"explicitly part of the Limited API. Even with ``Py_LIMITED_API`` defined, a "
"few private declarations are exposed for technical reasons (or even "
"unintentionally, as bugs)."
msgstr ""
"我们还建议查看所使用 API 的全部文档以检查其是否显式指明为受限 API 的一部分。 即使定义了 "
"``Py_LIMITED_API``,少数私有声明还是会出于技术原因(或者甚至是作为程序缺陷在无意中)被暴露出来。"
#: ../../c-api/stable.rst:139
msgid ""
"Also note that the Limited API is not necessarily stable: compiling with "
"``Py_LIMITED_API`` with Python 3.8 means that the extension will run with "
"Python 3.12, but it will not necessarily *compile* with Python 3.12. In "
"particular, parts of the Limited API may be deprecated and removed, provided"
" that the Stable ABI stays stable."
msgstr ""
"还要注意受限 API 并不必然是稳定的:在 Python 3.8 上用 ``Py_LIMITED_API`` 编译扩展意味着该扩展能在 Python "
"3.12 上运行,但它将不一定能用 Python 3.12 *编译*。 特别地,在稳定 ABI 保持稳定的情况下,部分受限 API "
"可能会被弃用并被移除。"
#: ../../c-api/stable.rst:149
msgid "Platform Considerations"
msgstr "平台的考虑"
#: ../../c-api/stable.rst:151
msgid ""
"ABI stability depends not only on Python, but also on the compiler used, "
"lower-level libraries and compiler options. For the purposes of the "
":ref:`Stable ABI <stable-abi>`, these details define a “platform”. They "
"usually depend on the OS type and processor architecture"
msgstr ""
"ABI 的稳定性不仅取决于 Python,取决于所使用的编译器、低层级库和编译器选项等。 对于 :ref:`稳定 ABI <stable-abi>` "
"的目标来说,这些细节定义了一个 “平台”。 它们通常会依赖于 OS 类型和处理器架构等。"
#: ../../c-api/stable.rst:156
msgid ""
"It is the responsibility of each particular distributor of Python to ensure "
"that all Python versions on a particular platform are built in a way that "
"does not break the Stable ABI. This is the case with Windows and macOS "
"releases from ``python.org`` and many third-party distributors."
msgstr ""
"确保在特定平台上的所有 Python 版本都以不破坏稳定 ABI 的方式构建是每个特定 Python 分发方的责任。 来自 ``python.org``"
" 以及许多第三方分发商的 Windows 和 macOS 发布版都必于这种情况。"
#: ../../c-api/stable.rst:166
msgid "Contents of Limited API"
msgstr "受限 API 的内容"
#: ../../c-api/stable.rst:169
msgid ""
"Currently, the :ref:`Limited API <limited-c-api>` includes the following "
"items:"
msgstr "目前 :ref:`受限 API <limited-c-api>` 包括下面这些项:"