@@ -370,6 +370,9 @@ msgid ""
370
370
" populated with fresh method and type objects. The old module is subject to "
371
371
"normal garbage collection. This mirrors the behavior of pure-Python modules."
372
372
msgstr ""
373
+ "不同于使用单阶段初始化创建的模块,这些模块不是单例对象。 举例来说,如果 :py:attr:`sys.modules` "
374
+ "条目被移除且模块被重新导入,一个新模块对象将被创建,并且通常会以新的方法和类型对象充实其内容。旧模块将成为正常垃圾回收的目标。 这类似于纯 Python"
375
+ " 模块的行为。"
373
376
374
377
#: ../../c-api/module.rst:302
375
378
msgid ""
@@ -379,6 +382,9 @@ msgid ""
379
382
" Python objects between module instances would likely cause crashes or "
380
383
"undefined behavior."
381
384
msgstr ""
385
+ "额外的模块实例可能会在 :ref:`子解释器 <sub-interpreter-support>` 中或者 Python 运行时重新初始化之后 "
386
+ "(:c:func:`Py_Finalize` 和 :c:func:`Py_Initialize`) 被创建。 在这些情况下,在模块实例之间共享 "
387
+ "Python 对象将可能导致程序崩溃或未定义的行为。"
382
388
383
389
#: ../../c-api/module.rst:309
384
390
msgid ""
@@ -388,12 +394,14 @@ msgid ""
388
394
"to a particular module instance. See :ref:`isolating-extensions-howto` for "
389
395
"more details and a practical guide."
390
396
msgstr ""
397
+ "为避免这种问题,每个扩展模块的实例都应当是 *隔离的*: 对一个实例的修改不应隐式地影响其他的实例,以及所有的状态,包括对 Python "
398
+ "对象的引用,都应当是特定模块实例专属的。 请参阅 :ref:`isolating-extensions-howto` 了解更多的细节和实用的指南。"
391
399
392
400
#: ../../c-api/module.rst:315
393
401
msgid ""
394
402
"A simpler way to avoid these issues is :ref:`raising an error on repeated "
395
403
"initialization <isolating-extensions-optout>`."
396
- msgstr ""
404
+ msgstr "一个避免这些问题的简单方式是 :ref:`针对重复的初始化引发一个错误 <isolating-extensions-optout>`。 "
397
405
398
406
#: ../../c-api/module.rst:318
399
407
msgid ""
@@ -403,6 +411,9 @@ msgid ""
403
411
"repeated initialization, as above. A module may also be limited to the main "
404
412
"interpreter using the :c:data:`Py_mod_multiple_interpreters` slot."
405
413
msgstr ""
414
+ "所有使用多阶段初始化创建的模块都应该支持 :ref:`子解释器 <sub-interpreter-support>`,否则要显式地发出缺乏支持的信号。 "
415
+ "这往往是通过隔离或阻止重复的初始化,如上文所述。 一个模块也可以使用 :c:data:`Py_mod_multiple_interpreters` "
416
+ "槽位将其限制于主解释器中。"
406
417
407
418
#: ../../c-api/module.rst:326
408
419
msgid ""
0 commit comments