@@ -1563,6 +1563,8 @@ msgid ""
15631563"Every call to :c:func:`PyGILState_Ensure` must be matched by a call to "
15641564":c:func:`PyGILState_Release` on the same thread."
15651565msgstr ""
1566+ "对 :c:func:`PyGILState_Ensure` 的每次调用都必须与在同一线程上对 :c:func:`PyGILState_Release` "
1567+ "的调用相匹配。"
15661568
15671569#: ../../c-api/init.rst:1153
15681570msgid ""
@@ -1571,6 +1573,8 @@ msgid ""
15711573" always has such a thread-state, even if no auto-thread-state call has been "
15721574"made on the main thread. This is mainly a helper/diagnostic function."
15731575msgstr ""
1576+ "获取此线程的当前线程状态。 如果当前线程上没有使用过 GILState API 则可以返回 ``NULL``。 "
1577+ "请注意主线程总是会有这样一个线程状态,即使没有在主线程上执行过自动线程状态调用。 这主要是一个辅助/诊断函数。"
15741578
15751579#: ../../c-api/init.rst:1161
15761580msgid ""
@@ -1582,12 +1586,15 @@ msgid ""
15821586"knowing that the GIL is locked can allow the caller to perform sensitive "
15831587"actions or otherwise behave differently."
15841588msgstr ""
1589+ "如果当前线程持有 GIL 则返回 ``1`` 否则返回 ``0``。 此函数可以随时从任何线程调用。 只有当它的 Python "
1590+ "线程状态已经初始化并且当前持有 GIL 时它才会返回 ``1``。 这主要是一个辅助/诊断函数。 例如在回调上下文或内存分配函数中会很有用处,当知道 "
1591+ "GIL 被锁定时可以允许调用方执行敏感的操作或是在其他情况下做出不同的行为。"
15851592
15861593#: ../../c-api/init.rst:1173
15871594msgid ""
15881595"The following macros are normally used without a trailing semicolon; look "
15891596"for example usage in the Python source distribution."
1590- msgstr ""
1597+ msgstr "以下的宏被使用时通常不带末尾分号;请在 Python 源代码发布包中查看示例用法。 "
15911598
15921599#: ../../c-api/init.rst:1179
15931600msgid ""
@@ -1596,6 +1603,8 @@ msgid ""
15961603"matched with a following :c:macro:`Py_END_ALLOW_THREADS` macro. See above "
15971604"for further discussion of this macro."
15981605msgstr ""
1606+ "此宏会扩展为 ``{ PyThreadState *_save; _save = PyEval_SaveThread();``。 "
1607+ "请注意它包含一个开头花括号;它必须与后面的 :c:macro:`Py_END_ALLOW_THREADS` 宏匹配。 有关此宏的进一步讨论请参阅上文。"
15991608
16001609#: ../../c-api/init.rst:1187
16011610msgid ""
0 commit comments