@@ -13,7 +13,7 @@ msgid ""
1313msgstr ""
1414"Project-Id-Version :Python 3.11\n "
1515"Report-Msgid-Bugs-To :\n "
16- "POT-Creation-Date :2025-04-18 15:31 +0000\n "
16+ "POT-Creation-Date :2025-04-25 15:29 +0000\n "
1717"PO-Revision-Date :2023-05-24 02:23+0000\n "
1818"Last-Translator :Rafael Fontenelle <rffontenelle@gmail.com>, 2025\n "
1919"Language-Team :Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -3307,6 +3307,12 @@ msgid ""
33073307"most POSIX systems it can and should be used in the ``#!`` line of system "
33083308"scripts. (Contributed by Christian Heimes in :issue:`16499`.)"
33093309msgstr ""
3310+ ":ref:`python <using-on-cmdline>` 命令增加了一个新的 :ref:`选项 <using-on-misc-options>`"
3311+ " ``-I``,将使其运行于“隔离模式”,即 :data:`sys.path` 将不包含脚本的目录和用户的 ``site-packages`` "
3312+ "目录,并且所有 :envvar:`!PYTHON*` 环境变量都将被忽略(相当于 ``-s`` 和 ``-E`` 同时启用)。 "
3313+ "未来还可能会应用其他的限制,其目的是将脚本执行与用户的环境隔离开来。 举例来说,当 Python 被用于运行系统脚本时此模式将是适当的。 在大多数 "
3314+ "POSIX 系统上它可以并且应当在系统脚本的 ``#!`` 行中使用。 (由 Christian Heimes 在 :issue:`16499` "
3315+ "中贡献。)"
33103316
33113317#: ../../whatsnew/3.4.rst:1947
33123318msgid ""
@@ -3315,6 +3321,9 @@ msgid ""
33153321"and is written to (and read from) the file :file:`~/.python-history`. "
33163322"(Contributed by Antoine Pitrou and Éric Araujo in :issue:`5845`.)"
33173323msgstr ""
3324+ "在支持 :mod:`readline` 的系统上的交互模式中现在将默认启用 Tab 键补全。 历史记录也将默认启用,并会写入到 "
3325+ ":file:`~/.python-history` 文件(也会从中读取)。 (由 Antoine Pitrou 和 Éric Araujo 在 "
3326+ ":issue:`5845` 中贡献。)"
33183327
33193328#: ../../whatsnew/3.4.rst:1952
33203329msgid ""
@@ -3323,6 +3332,8 @@ msgid ""
33233332"changes were made to :mod:`argparse` (:issue:`18920`) and other modules that"
33243333" have script-like invocation capabilities (:issue:`18922`)."
33253334msgstr ""
3335+ "现在附带 ``--version`` 唤起 Python 解释器将会把版本信息输出到标准输出而不是标准错误 (:issue:`18338`)。 对于 "
3336+ ":mod:`argparse` (:issue:`18920`) 和其他具有脚本类唤起功能的模块也做了类似的修改 (:issue:`18922`)。"
33263337
33273338#: ../../whatsnew/3.4.rst:1957
33283339msgid ""
@@ -3455,6 +3466,10 @@ msgid ""
34553466"Set LINEAR_PROBES=0 to turn-off linear probing entirely. (Contributed by "
34563467"Raymond Hettinger in :issue:`18771`.)"
34573468msgstr ""
3469+ "针对集合的哈希碰撞的耗费现在已被降低。 每次哈希表检测现在会先检查一系列连续的、相邻的键/哈希值对再继续对整个哈希表执行随机检测。 "
3470+ "这将利用缓存本地化来使得碰撞求解付出较少代价。 这种碰撞求解方案可被描述为线性检测和开放寻址的结合。 额外的线性检测数默认为九次。 这可以在编译时通过将"
3471+ " LINEAR_PROBES 定义为任意值来修改。 设置 LINEAR_PROBES=0 可完全关闭线性检测。 (由 Raymond Hettinger"
3472+ " 在 :issue:`18771` 中贡献。)"
34583473
34593474#: ../../whatsnew/3.4.rst:2028
34603475msgid ""
@@ -3466,26 +3481,37 @@ msgid ""
34663481"Heimes and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:`19209`,"
34673482" :issue:`19205` and :issue:`9548`.)"
34683483msgstr ""
3484+ "解释器启动速度加快了约 30%。 多项措施促成了此次加速。 解释器在启动时加载的模块有所减少,例如 :mod:`re`, "
3485+ ":mod:`collections` 和 :mod:`locale` 模块及其依赖默认不再被导入。 marshal 模块得到改进以便更快速地加载已编译的"
3486+ " Python 代码。 (由 Antoine Pitrou, Christian Heimes 和 Victor Stinner 在 "
3487+ ":issue:`19219`, :issue:`19218`, :issue:`19209`, :issue:`19205` 和 "
3488+ ":issue:`9548` 中贡献。)"
34693489
34703490#: ../../whatsnew/3.4.rst:2036
34713491msgid ""
34723492":class:`bz2.BZ2File` is now as fast or faster than the Python2 version for "
34733493"most cases. :class:`lzma.LZMAFile` has also been optimized. (Contributed "
34743494"by Serhiy Storchaka and Nadeem Vawda in :issue:`16034`.)"
34753495msgstr ""
3496+ "现在 :class:`bz2.BZ2File` 在多数情况下相比 Python2 版本速度都一样快更快或。 :class:`lzma.LZMAFile`"
3497+ " 也获得了优化。 (由 Serhiy Storchaka 和 Nadeem Vawda 在 :issue:`16034` 中贡献。)"
34763498
34773499#: ../../whatsnew/3.4.rst:2040
34783500msgid ""
34793501":func:`random.getrandbits` is 20%-40% faster for small integers (the most "
34803502"common use case). (Contributed by Serhiy Storchaka in :issue:`16674`.)"
34813503msgstr ""
3504+ ":func:`random.getrandbits` 对于小整数(最常见的应用场景)可加速 20%-40%。 (由 Serhiy Storchaka 在"
3505+ " :issue:`16674` 中贡献。)"
34823506
34833507#: ../../whatsnew/3.4.rst:2043
34843508msgid ""
34853509"By taking advantage of the new storage format for strings, pickling of "
34863510"strings is now significantly faster. (Contributed by Victor Stinner and "
34873511"Antoine Pitrou in :issue:`15596`.)"
34883512msgstr ""
3513+ "得益于字符串的新存储格式,对字符串执行 pickle 操作现在将有明显加速。 (由 Victor Stinner 和 Antoine Pitrou 在 "
3514+ ":issue:`15596` 中贡献。)"
34893515
34903516#: ../../whatsnew/3.4.rst:2047
34913517msgid ""
@@ -3494,6 +3520,9 @@ msgid ""
34943520" significant amounts of data through :mod:`subprocess`. (Contributed by "
34953521"Richard Oudkerk in :issue:`15758`.)"
34963522msgstr ""
3523+ "一个 :meth:`io.FileIO.readall` 中的性能问题已被解决。 这对 Windows 有更具体的情况,将显著地提升通过 "
3524+ ":mod:`subprocess` 以管道方式传递大量数据这一应用场景下的速度。 (由 Richard Oudkerk 在 :issue:`15758`"
3525+ " 中贡献。)"
34973526
34983527#: ../../whatsnew/3.4.rst:2052
34993528msgid ""
@@ -3532,6 +3561,9 @@ msgid ""
35323561":exc:`DeprecationWarning` when the interpreter is run with deprecation "
35333562"warnings enabled (for example, by using ``-Wd``)."
35343563msgstr ""
3564+ "本小节列出了已在 Python 3.4 中弃用,并将在 Python 3.5 或之后的版本中移除的各种 API 和其他特性。 "
3565+ "在大多数(但并非全部)情况下,在解释器运行时设置了弃用警告时(例如通过使用 ``-Wd`` 选项)使用已弃用的 API 将产生 "
3566+ ":exc:`DeprecationWarning`。"
35353567
35363568#: ../../whatsnew/3.4.rst:2077
35373569msgid "Deprecations in the Python API"
@@ -3790,6 +3822,10 @@ msgid ""
37903822"objects that do not have a __format__ method that handles it. See "
37913823":issue:`7994` for background."
37923824msgstr ""
3825+ ":meth:`object.__format__` 不再接受非空格式字符串,它现在会改为引发 :exc:`TypeError`。 使用非空字符串自 "
3826+ "Python 3.2 起已被弃用。 做出此项改变是为了防止当对象获得 __format__ "
3827+ "方法时之前可用(但不正确)的代码执行失败的情况,这意味着现在当你对没有用于处理 ``'s'`` 的 __format__ "
3828+ "方法的对象使用该格式代码时你的代码可能会引发 :exc:`TypeError`。 请参阅 :issue:`7994` 了解相关背景。"
37933829
37943830#: ../../whatsnew/3.4.rst:2216
37953831msgid ""
@@ -3854,6 +3890,9 @@ msgid ""
38543890"how :envvar:`PATH` works. The behavior now conforms to the posix convention"
38553891" for :envvar:`PATH`."
38563892msgstr ""
3893+ "在 posix shell 中,将 :envvar:`PATH` 环境变量设为空值就等于完全不设置。 不过,将 :envvar:`PYTHONPATH`"
3894+ " 设为空值则 *不等于* 完全不设置:将 :envvar:`PYTHONPATH` 设为空值等于将其设为 ``.``,这在类 "
3895+ ":envvar:`PATH` 运作方式来进行理解时会导致困惑。 现在的行为将与 posix 中 :envvar:`PATH` 的惯例保持一致。"
38573896
38583897#: ../../whatsnew/3.4.rst:2257
38593898msgid ""
@@ -3862,13 +3901,17 @@ msgid ""
38623901"``-X showrefcount`` option. (Contributed by Ezio Melotti in "
38633902":issue:`17323`.)"
38643903msgstr ""
3904+ "现在 CPython 解释器的调试构建版 (``--with-pydebug``) 的 [X refs, Y blocks] 输出默认将关闭。 可以使用"
3905+ " ``-X showrefcount`` 选项来重新启用它。 (由 Ezio Melotti 在 :issue:`17323` 中贡献。)"
38653906
38663907#: ../../whatsnew/3.4.rst:2261
38673908msgid ""
38683909"The python command and most stdlib scripts (as well as :mod:`argparse`) now "
38693910"output ``--version`` information to ``stdout`` instead of ``stderr`` (for "
38703911"issue list see :ref:`other-improvements-3.4` above)."
38713912msgstr ""
3913+ "现在 python 命令和大多数标准库脚本(和 :mod:`argparse` 一样)会将 ``--version`` 信息输出到 ``stdout``"
3914+ " 而不是 ``stderr`` (相关问题列表参见上面的 :ref:`other-improvements-3.4`)。"
38723915
38733916#: ../../whatsnew/3.4.rst:2267
38743917msgid "Changes in the Python API"
@@ -3883,6 +3926,9 @@ msgid ""
38833926"compatibility, catch both :exc:`NotImplementedError` or the appropriate "
38843927"exception as needed."
38853928msgstr ""
3929+ "在 :mod:`importlib.abc` 中定义的 ABC 现在将会引发适当的异常或是返回默认值而不是无脑引发 "
3930+ ":exc:`NotImplementedError`。 这将只影响调用 :func:`super` 并一路下落到这些 ABC 的代码。 "
3931+ "为保持兼容性,:exc:`NotImplementedError` 和所需的相应异常都要被捕获。"
38863932
38873933#: ../../whatsnew/3.4.rst:2275
38883934msgid ""
@@ -3907,6 +3953,9 @@ msgid ""
39073953"reloading. Note that this restores a pre-3.3 behavior in that it means a "
39083954"module is re-found when re-loaded (:issue:`19413`)."
39093955msgstr ""
3956+ "当重载时 import 操作现在会无条件地重置相关属性 (例如 ``__name__``, ``__loader__``, "
3957+ "``__package__``, ``__file__``, ``__cached__``)。 请注意在模块重载时会被重发现这一点上该操作恢复了 3.3"
3958+ " 之前的行为 (:issue:`19413`)。"
39103959
39113960#: ../../whatsnew/3.4.rst:2290
39123961msgid ""
@@ -3917,6 +3966,9 @@ msgid ""
39173966"to determine if a module is a package or not is to use ``hasattr(module, "
39183967"'__path__')`` (:issue:`18065`)."
39193968msgstr ""
3969+ "冻结的包将不再把 ``__path__`` 设为一个包含包名的列表,它们现在会把它设为一个空列表。 "
3970+ "当存在与冻结的包同名的目录时之前版本的行为可能会使导入系统错误地处理子模块。 确定一个模块是否属于包的正确方式是使用 ``hasattr(module,"
3971+ " '__path__')`` (:issue:`18065`)。"
39203972
39213973#: ../../whatsnew/3.4.rst:2297
39223974msgid ""
@@ -3936,6 +3988,8 @@ msgid ""
39363988" a warning that import will overwrite those files with a regular file "
39373989"regardless of what type of file path they were originally."
39383990msgstr ""
3991+ "现在 :func:`py_compile.compile` 在它要写入的文件路径是符号链接或非常规文件时会引发 "
3992+ ":exc:`FileExistsError`。 这是为了提示导入系统将用一个常规文件覆盖相应文件而不管原始文件路径是什么类型而发出的警告。"
39393993
39403994#: ../../whatsnew/3.4.rst:2310
39413995msgid ""
@@ -3948,6 +4002,10 @@ msgid ""
39484002"before and wish to continue to ignore syntax or decoding issues, catch all "
39494003"three exceptions now."
39504004msgstr ""
4005+ "当被加载的源代码触发了 :exc:`SyntaxError` 或 :exc:`UnicodeDecodeError` 时 "
4006+ ":meth:`importlib.abc.SourceLoader.get_source` 将不再引发 :exc:`ImportError`。 因为 "
4007+ ":exc:`ImportError` 本意只是在应该找到源代码但却找不到时被引发,而在源代码已找到但结构不正确时使用此异常会感觉有些过度/过载。 "
4008+ "如果你在之前是捕获 ImportError 并希望继续忽略语法或解码问题,现在应当捕获所有这三个异常。"
39514009
39524010#: ../../whatsnew/3.4.rst:2319
39534011msgid ""
@@ -3960,6 +4018,10 @@ msgid ""
39604018"behaviour was intentional can use :func:`inspect.unwrap` to access the first"
39614019" function in the chain that has no ``__wrapped__`` attribute."
39624020msgstr ""
4021+ "现在 :func:`functools.update_wrapper` 和 :func:`functools.wraps` 会正确地将 "
4022+ "``__wrapped__`` 属性设为被包装的函数,即使该函数同样设置了 ``__wrapped__`` 属性。 这意味着 "
4023+ "``__wrapped__`` 属性现在会正确地链接由被装饰函数组成的栈而不是链中指向最内层函数的的每个 ``__wrapped__`` 属性。 "
4024+ "确定要沿袭之前版本行为的内省库可以使用 :func:`inspect.unwrap` 来访问链中没有 ``__wrapped__`` 属性的第一个函数。"
39634025
39644026#: ../../whatsnew/3.4.rst:2329
39654027msgid ""
@@ -4155,6 +4217,9 @@ msgid ""
41554217"deprecated. This key should be replaced by ``EXT_SUFFIX`` or "
41564218"``SHLIB_SUFFIX``, depending on the context (:issue:`19555`)."
41574219msgstr ""
4220+ "附带 ``SO`` 键调用 :func:`sysconfig.get_config_var`,或者在对 "
4221+ ":func:`sysconfig.get_config_vars` 的调用结果中查找 ``SO`` 的做法已被弃用。 该键应当被 "
4222+ "``EXT_SUFFIX`` 或 ``SHLIB_SUFFIX`` 替代,由具体场景决定 (:issue:`19555`)。"
41584223
41594224#: ../../whatsnew/3.4.rst:2455
41604225msgid ""
@@ -4165,12 +4230,16 @@ msgid ""
41654230" stream in :mod:`~io.TextIOWrapper` to use its *newline* argument "
41664231"(:issue:`15204`)."
41674232msgstr ""
4233+ "任何指定了 ``U`` 的 ``open`` 函数调用都应当被修改。 ``U`` 在 Python3 将没有效果并且最终会在被使用时引发错误。 "
4234+ "对于该函数,要得到与它的旧 Python2 行为相同的效果可以使用 *newline* 参数,或者在必要时将流包装在 "
4235+ ":mod:`~io.TextIOWrapper` 以使用其 *newline* 参数 (:issue:`15204`)。"
41684236
41694237#: ../../whatsnew/3.4.rst:2462
41704238msgid ""
41714239"If you use ``pyvenv`` in a script and desire that pip *not* be installed, "
41724240"you must add ``--without-pip`` to your command invocation."
41734241msgstr ""
4242+ "如果你在脚本中使用 ``pyvenv`` 并且希望 *不要* 安装 pip,你必须在你的唤起命令中添加 ``--without-pip``。"
41744243
41754244#: ../../whatsnew/3.4.rst:2466
41764245msgid ""
@@ -4180,6 +4249,9 @@ msgid ""
41804249"you have tests that are doing white-space-sensitive comparisons of such "
41814250"output (:issue:`16333`)."
41824251msgstr ""
4252+ ":func:`json.dump` 和 :func:`json.dumps` "
4253+ "在指定了缩进值时的默认行为已被改变:它不会在行末的条目分隔逗号后面再附加空格。 此项改变仅在你使用了对这样的输出执行空格敏感比较的测试时才会有影响 "
4254+ "(:issue:`16333`)。"
41834255
41844256#: ../../whatsnew/3.4.rst:2472
41854257msgid ""
@@ -4222,6 +4294,11 @@ msgid ""
42224294"when invoking these operations (directly or indirectly) and running against "
42234295"a version of Python that is compiled with assertions enabled."
42244296msgstr ""
4297+ "现在 :c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr` 和 "
4298+ ":c:func:`PyObject_Str` 以及其他一些内部 C API "
4299+ "都包括了一个调试断言,以确保它们不会在可能会静默地丢弃当前活动异常的情况下使用。 在预期并且希望丢弃活动异常的情况下(例如,由于已通过 "
4300+ ":c:func:`PyErr_Fetch` 将其保存在本地或是有意将其替换为不同的异常 ),则需调用显式的 :c:func:`PyErr_Clear` "
4301+ "以避免在(直接或间接)唤起这些操作和针对启用断言编译的 Python 的版本运行时触发断言。"
42254302
42264303#: ../../whatsnew/3.4.rst:2500
42274304msgid ""