-
-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathstable.po
More file actions
371 lines (326 loc) · 18 KB
/
Copy pathstable.po
File metadata and controls
371 lines (326 loc) · 18 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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# 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.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-03 14:16+0000\n"
"PO-Revision-Date: 2025-09-15 01:03+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 ""
"Unless documented otherwise, Python's C API is covered by the Backwards "
"Compatibility Policy, :pep:`387`. Most changes to it are 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` 所描述的向下兼容策略。 "
"对它的大部分改变都是源代码级兼容的(通常只会增加新的 new API)。 改变现有 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 "There are two tiers of C API with different stability expectations:"
msgstr "存在具有不同稳定性预期的两个 C API 层次:"
#: ../../c-api/stable.rst:23
msgid ""
":ref:`Unstable API <unstable-c-api>`, may change in minor versions without a"
" deprecation period. It is marked by the ``PyUnstable`` prefix in names."
msgstr ""
":ref:`不稳定 API <unstable-c-api>`,可能在次要版本中发生改变而没有弃用期。 它的名称会以 ``PyUnstable`` "
"前缀来标记。"
#: ../../c-api/stable.rst:25
msgid ""
":ref:`Limited API <limited-c-api>`, is compatible across several minor "
"releases. When :c:macro:`Py_LIMITED_API` is defined, only this subset is "
"exposed from ``Python.h``."
msgstr ""
":ref:`受限 API <limited-c-api>`,将会在多个次要版本间保持兼容。 当定义了 :c:macro:`Py_LIMITED_API`"
" 时,将只有这个子集会从 ``Python.h`` 对外公开。"
#: ../../c-api/stable.rst:29
msgid "These are discussed in more detail below."
msgstr "这些将在下文中更详细地讨论。"
#: ../../c-api/stable.rst:31
msgid ""
"Names prefixed by an underscore, such as ``_Py_InternalState``, are private "
"API that can change without notice even in patch releases. If you need to "
"use this API, consider reaching out to `CPython developers "
"<https://discuss.python.org/c/core-dev/c-api/30>`_ to discuss adding public "
"API for your use case."
msgstr ""
"带有一个下划线前缀的名称,如 ``_Py_InternalState``,是可能不经通知就改变甚至是在补丁发布版中改变的私有 API。 "
"如果你需要使用这样的 API,请考虑联系 `CPython 开发团队 <https://discuss.python.org/c/core-"
"dev/c-api/30>`_ 来讨论为你的应用场景添加公有 API。"
#: ../../c-api/stable.rst:40
msgid "Unstable C API"
msgstr "不稳定 C API"
#: ../../c-api/stable.rst:44
msgid ""
"Any API named with the ``PyUnstable`` prefix exposes CPython implementation "
"details, and may change in every minor release (e.g. from 3.9 to 3.10) "
"without any deprecation warnings. However, it will not change in a bugfix "
"release (e.g. from 3.10.0 to 3.10.1)."
msgstr ""
"任何名称带有 ``PyUnstable`` 前缀的 API 都将对外公开 CPython 的实现细节,并可能不加弃用警告即在次要版本中发生改变(例如从 "
"3.9 到 3.10)。 但是,它不会在问题修正发布版中改变(例如从 3.10.0 到 3.10.1)。"
#: ../../c-api/stable.rst:49
msgid ""
"It is generally intended for specialized, low-level tools like debuggers."
msgstr "它通常是针对专门的,低层级的工具如调试器等。"
#: ../../c-api/stable.rst:51
msgid ""
"Projects that use this API are expected to follow CPython development and "
"spend extra effort adjusting to changes."
msgstr "使用此 API 的项目需要跟随 CPython 开发进程并花费额外的努力来适应改变。"
#: ../../c-api/stable.rst:56
msgid "Stable Application Binary Interface"
msgstr "应用程序二进制接口的稳定版"
#: ../../c-api/stable.rst:58
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:65
msgid "Limited C API"
msgstr "受限 C API"
#: ../../c-api/stable.rst:67
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 be loaded "
"on 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:74
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:77
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 be ABI-compatible 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 发布版保持 ABI 兼容,并可使用到该版本为止所引入的受限 API。"
#: ../../c-api/stable.rst:83
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:87
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:94
msgid "Stable ABI"
msgstr "稳定 ABI"
#: ../../c-api/stable.rst:96
msgid ""
"To enable this, Python provides a *Stable ABI*: a set of symbols that will "
"remain ABI-compatible across Python 3.x versions."
msgstr "为启用此特性,Python 提供了一个 *稳定 ABI*:即一组将跨 Python 3.x 各个版本保持 ABI 兼容的符号集合。"
#: ../../c-api/stable.rst:101
msgid ""
"The Stable ABI prevents ABI issues, like linker errors due to missing "
"symbols or data corruption due to changes in structure layouts or function "
"signatures. However, other changes in Python can change the *behavior* of "
"extensions. See Python's Backwards Compatibility Policy (:pep:`387`) for "
"details."
msgstr ""
"稳定 ABI 将防止多种 ABI 问题,如由于缺失符号导致的链接器错误或由于结构体布局或函数签名中的变化导致的数据损坏。 不过,Python "
"中的其他修改可能改变扩展的 *行为*。 请参阅 Python 的向下兼容策略 (:pep:`387`) 了解详情。"
#: ../../c-api/stable.rst:107
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:111
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:115
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:122
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:128
msgid "Limited API Scope and Performance"
msgstr "受限 API 的作用域和性能"
#: ../../c-api/stable.rst:130
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:133
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:138
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:143
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:152
msgid "Limited API Caveats"
msgstr "受限 API 警示"
#: ../../c-api/stable.rst:154
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:159
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:166
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:169
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:172
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:177
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:187
msgid "Platform Considerations"
msgstr "平台的考虑"
#: ../../c-api/stable.rst:189
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:194
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:204
msgid "Contents of Limited API"
msgstr "受限 API 的内容"
#: ../../c-api/stable.rst:207
msgid ""
"Currently, the :ref:`Limited API <limited-c-api>` includes the following "
"items:"
msgstr "目前 :ref:`受限 API <limited-c-api>` 包括下面这些项:"
#: ../../c-api/stable.rst:42
msgid "PyUnstable"
msgstr "PyUnstable"