@@ -98,16 +98,20 @@ msgid ""
9898" function :func:`__import__`, as the standard :func:`__import__` function "
9999"calls this function directly."
100100msgstr ""
101+ "导入一个模块。 关于此函数的最佳说明请参考内置 Python 函数 :func:`__import__`,因为标准 :func:`__import__`"
102+ " 函数会直接调用此函数。"
101103
102104#: ../../c-api/import.rst:75
103105msgid ""
104106"Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is a "
105107"UTF-8 encoded string instead of a Unicode object."
106108msgstr ""
109+ "类似于 :c:func:`PyImport_ImportModuleLevelObject`,但其名称为 UTF-8 编码的字符串而不是 Unicode"
110+ " 对象。"
107111
108112#: ../../c-api/import.rst:78
109113msgid "Negative values for *level* are no longer accepted."
110- msgstr ""
114+ msgstr "不再接受 *level* 为负数值。 "
111115
112116#: ../../c-api/import.rst:83
113117msgid ""
@@ -117,12 +121,14 @@ msgid ""
117121"current globals. This means that the import is done using whatever import "
118122"hooks are installed in the current environment."
119123msgstr ""
124+ "这是一个调用了当前“导入钩子函数”的更高层级接口(显式指定 *level* 为 0,表示绝对导入)。 它将发起调用当前全局作用域下 "
125+ "``__builtins__`` 中的 :func:`__import__` 函数。 这意味着将使用当前环境下安装的任何导入钩子来完成导入。"
120126
121127#: ../../c-api/import.rst:94
122128msgid ""
123129"Reload a module. Return a new reference to the reloaded module, or ``NULL``"
124130" with an exception set on failure (the module still exists in this case)."
125- msgstr ""
131+ msgstr "重载一个模块。 返回一个指向被重载模块的新引用,或者在失败时返回 ``NULL`` 并设置一个异常(在此情况下模块仍然会存在)。 "
126132
127133#: ../../c-api/import.rst:100
128134msgid ""
@@ -131,6 +137,8 @@ msgid ""
131137"dictionary if there's one there, and if not, create a new one and insert it "
132138"in the modules dictionary. Return ``NULL`` with an exception set on failure."
133139msgstr ""
140+ "返回对应于某个模块名称的模块对象。 *name* 参数的形式可以为 ``package.module``。 如果存在 modules "
141+ "字典则首先检查该字典,如果找不到,则创建一个新模块并将其插入到 modules 字典。 在失败时返回 ``NULL`` 并设置一个异常。"
134142
135143#: ../../c-api/import.rst:107
136144msgid ""
@@ -140,12 +148,16 @@ msgid ""
140148"Package structures implied by a dotted name for *name* are not created if "
141149"not already present."
142150msgstr ""
151+ "此函数不会加载或导入指定模块;如果模块还未被加载,你将得到一个空的模块对象。 请使用 :c:func:`PyImport_ImportModule` "
152+ "或它的某个变体形式来导入模块。 *name* 使用带点号名称的包结构如果尚不存在则不会被创建。"
143153
144154#: ../../c-api/import.rst:117
145155msgid ""
146156"Similar to :c:func:`PyImport_AddModuleObject`, but the name is a UTF-8 "
147157"encoded string instead of a Unicode object."
148158msgstr ""
159+ "类似于 :c:func:`PyImport_AddModuleObject`,但其名称为 UTF-8 编码的字符串而不是 Unicode "
160+ "对象。object."
149161
150162#: ../../c-api/import.rst:125
151163msgid ""
@@ -160,6 +172,11 @@ msgid ""
160172" to know that the module object is an unknown (and probably damaged with "
161173"respect to the module author's intents) state."
162174msgstr ""
175+ "给定一个模块名称(可能为 ``package.module`` 形式)和一个从 Pyhon 字节码文件读取或从内置函数 :func:`compile` "
176+ "获取的代码对象,加载该模块。 返回对该模块对象的新引用,或者如果发生错误则返回 ``NULL`` 并设置一个异常。 在发生错误的情况下 *name* "
177+ "会从 :attr:`sys.modules` 中被移除,即使 *name* 在进入 :c:func:`PyImport_ExecCodeModule` "
178+ "时已存在于 :attr:`sys.modules` 中。 在 :attr:`sys.modules` "
179+ "中保留未完全初始化的模块是危险的,因为导入这样的模块没有办法知道模块对象是否处于一种未知的(对于模块作业的意图来说可能是已损坏的)状态。"
163180
164181#: ../../c-api/import.rst:135
165182msgid ""
@@ -168,6 +185,8 @@ msgid ""
168185" module's ``__loader__`` (if set) and to an instance of "
169186":class:`SourceFileLoader` otherwise."
170187msgstr ""
188+ "模块的 :attr:`__spec__` 和 :attr:`__loader__` 如果尚未设置的话,将被设置为适当的值。 相应 spec "
189+ "的加载器(如果已设置)将被设为模块的 ``__loader__`` 而在其他情况下设为 :class:`SourceFileLoader` 的实例。"
171190
172191#: ../../c-api/import.rst:140
173192msgid ""
0 commit comments