@@ -12,7 +12,7 @@ msgid ""
1212msgstr ""
1313"Project-Id-Version : Python 3.12\n "
1414"Report-Msgid-Bugs-To : \n "
15- "POT-Creation-Date : 2024-08-09 17:14 +0000\n "
15+ "POT-Creation-Date : 2024-09-20 14:57 +0000\n "
1616"PO-Revision-Date : 2024-05-11 00:32+0000\n "
1717"
Last-Translator :
Rafael Fontenelle <[email protected] >, 2024\n "
1818"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -983,6 +983,10 @@ msgid ""
983983"something like ::"
984984msgstr "返回 Python 解释器的版本。 这将为如下形式的字符串 ::"
985985
986+ #: ../../c-api/init.rst:663
987+ msgid "\" 3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\ n[GCC 4.2.3]\" "
988+ msgstr "\" 3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\ n[GCC 4.2.3]\" "
989+
986990#: ../../c-api/init.rst:667
987991msgid ""
988992"The first word (up to the first space character) is the current Python "
@@ -1034,6 +1038,10 @@ msgid ""
10341038"version, in square brackets, for example::"
10351039msgstr "返回用于编译当前 Python 版本的编译器指令,为带方括号的形式,例如::"
10361040
1041+ #: ../../c-api/init.rst:705
1042+ msgid "\" [GCC 2.7.2.2]\" "
1043+ msgstr "\" [GCC 2.7.2.2]\" "
1044+
10371045#: ../../c-api/init.rst:709 ../../c-api/init.rst:723
10381046msgid ""
10391047"The returned string points into static storage; the caller should not modify"
@@ -1047,6 +1055,10 @@ msgid ""
10471055" current Python interpreter instance, for example ::"
10481056msgstr "返回有关当前Python解释器实例的序列号和构建日期和时间的信息,例如:"
10491057
1058+ #: ../../c-api/init.rst:719
1059+ msgid "\" #67, Aug 1 1997, 22:34:28\" "
1060+ msgstr "\" #67, Aug 1 1997, 22:34:28\" "
1061+
10501062#: ../../c-api/init.rst:735
10511063msgid ""
10521064"This API is kept for backward compatibility: setting "
@@ -1124,6 +1136,10 @@ msgstr ""
11241136"在 3.1.3 之前的版本中,你可以通过在调用 :c:func:`PySys_SetArgv` 之后手动弹出第一个 :data:`sys.path` "
11251137"元素,例如使用::"
11261138
1139+ #: ../../c-api/init.rst:776
1140+ msgid "PyRun_SimpleString(\" import sys; sys.path.pop(0)\\ n\" );"
1141+ msgstr "PyRun_SimpleString(\" import sys; sys.path.pop(0)\\ n\" );"
1142+
11271143#: ../../c-api/init.rst:788
11281144msgid ""
11291145"This API is kept for backward compatibility: setting "
@@ -1232,10 +1248,26 @@ msgid ""
12321248"structure::"
12331249msgstr "大多数操作 :term:`GIL` 的扩展代码具有以下简单结构:"
12341250
1251+ #: ../../c-api/init.rst:882
1252+ msgid ""
1253+ "Save the thread state in a local variable.\n"
1254+ "Release the global interpreter lock.\n"
1255+ "... Do some blocking I/O operation ...\n"
1256+ "Reacquire the global interpreter lock.\n"
1257+ "Restore the thread state from the local variable."
1258+ msgstr ""
1259+
12351260#: ../../c-api/init.rst:888
12361261msgid "This is so common that a pair of macros exists to simplify it::"
12371262msgstr "这是如此常用因此增加了一对宏来简化它::"
12381263
1264+ #: ../../c-api/init.rst:890
1265+ msgid ""
1266+ "Py_BEGIN_ALLOW_THREADS\n"
1267+ "... Do some blocking I/O operation ...\n"
1268+ "Py_END_ALLOW_THREADS"
1269+ msgstr ""
1270+
12391271#: ../../c-api/init.rst:898
12401272msgid ""
12411273"The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a"
@@ -1249,6 +1281,15 @@ msgstr ""
12491281msgid "The block above expands to the following code::"
12501282msgstr "上面的代码块可扩展为下面的代码::"
12511283
1284+ #: ../../c-api/init.rst:904
1285+ msgid ""
1286+ "PyThreadState *_save;\n"
1287+ "\n"
1288+ "_save = PyEval_SaveThread();\n"
1289+ "... Do some blocking I/O operation ...\n"
1290+ "PyEval_RestoreThread(_save);"
1291+ msgstr ""
1292+
12521293#: ../../c-api/init.rst:914
12531294msgid ""
12541295"Here is how these functions work: the global interpreter lock is used to "
@@ -1314,6 +1355,19 @@ msgstr ""
13141355":c:func:`PyGILState_Ensure` 和 :c:func:`PyGILState_Release` 函数会自动完成上述的所有操作。 从"
13151356" C 线程调用到 Python 的典型方式如下::"
13161357
1358+ #: ../../c-api/init.rst:955
1359+ msgid ""
1360+ "PyGILState_STATE gstate;\n"
1361+ "gstate = PyGILState_Ensure();\n"
1362+ "\n"
1363+ "/* Perform Python actions here. */\n"
1364+ "result = CallSomeFunction();\n"
1365+ "/* evaluate result or handle exception */\n"
1366+ "\n"
1367+ "/* Release the thread. No Python API allowed beyond this point. */\n"
1368+ "PyGILState_Release(gstate);"
1369+ msgstr ""
1370+
13171371#: ../../c-api/init.rst:965
13181372msgid ""
13191373"Note that the ``PyGILState_*`` functions assume there is only one global "
@@ -2159,6 +2213,20 @@ msgid ""
21592213"certain functionality restricted::"
21602214msgstr "子解释器在彼此相互隔离,并让特定功能受限的情况下是最有效率的::"
21612215
2216+ #: ../../c-api/init.rst:1638
2217+ msgid ""
2218+ "PyInterpreterConfig config = {\n"
2219+ " .use_main_obmalloc = 0,\n"
2220+ " .allow_fork = 0,\n"
2221+ " .allow_exec = 0,\n"
2222+ " .allow_threads = 1,\n"
2223+ " .allow_daemon_threads = 0,\n"
2224+ " .check_multi_interp_extensions = 1,\n"
2225+ " .gil = PyInterpreterConfig_OWN_GIL,\n"
2226+ "};\n"
2227+ "PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);"
2228+ msgstr ""
2229+
21622230#: ../../c-api/init.rst:1649
21632231msgid ""
21642232"Note that the config is used only briefly and does not get modified. During "
0 commit comments