@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version : Python 3.13\n "
1313"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2025-08-19 15:18 +0000\n "
14+ "POT-Creation-Date : 2025-08-27 15:16 +0000\n "
1515"PO-Revision-Date : 2025-07-18 19:20+0000\n "
1616"Last-Translator : Rafael Fontenelle <rffontenelle@gmail.com>, 2025\n "
1717"Language-Team : Russian (https://app.transifex.com/python-doc/teams/5390/ru/)\n "
@@ -2854,24 +2854,34 @@ msgstr ""
28542854
28552855#: ../../c-api/init.rst:2399
28562856msgid ""
2857- "Critical sections avoid deadlocks by implicitly suspending active critical "
2858- "sections and releasing the locks during calls to "
2859- ":c:func:`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, "
2860- "the most recent critical section is resumed, and its locks reacquired. This"
2861- " means the critical section API provides weaker guarantees than traditional "
2862- "locks -- they are useful because their behavior is similar to the "
2863- ":term:`GIL`."
2857+ "Critical sections are intended to be used for custom types implemented in "
2858+ "C-API extensions. They should generally not be used with built-in types like"
2859+ " :class:`list` and :class:`dict` because their public C-APIs already use "
2860+ "critical sections internally, with the notable exception of "
2861+ ":c:func:`PyDict_Next`, which requires critical section to be acquired "
2862+ "externally."
28642863msgstr ""
28652864
28662865#: ../../c-api/init.rst:2406
28672866msgid ""
2867+ "Critical sections avoid deadlocks by implicitly suspending active critical "
2868+ "sections, hence, they do not provide exclusive access such as provided by "
2869+ "traditional locks like :c:type:`PyMutex`. When a critical section is "
2870+ "started, the per-object lock for the object is acquired. If the code "
2871+ "executed inside the critical section calls C-API functions then it can "
2872+ "suspend the critical section thereby releasing the per-object lock, so other"
2873+ " threads can acquire the per-object lock for the same object."
2874+ msgstr ""
2875+
2876+ #: ../../c-api/init.rst:2414
2877+ msgid ""
28682878"The functions and structs used by the macros are exposed for cases where C "
28692879"macros are not available. They should only be used as in the given macro "
28702880"expansions. Note that the sizes and contents of the structures may change in"
28712881" future Python versions."
28722882msgstr ""
28732883
2874- #: ../../c-api/init.rst:2413
2884+ #: ../../c-api/init.rst:2421
28752885msgid ""
28762886"Operations that need to lock two objects at once must use "
28772887":c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical "
@@ -2880,11 +2890,11 @@ msgid ""
28802890"a way to lock more than two objects at once."
28812891msgstr ""
28822892
2883- #: ../../c-api/init.rst:2419
2893+ #: ../../c-api/init.rst:2427
28842894msgid "Example usage::"
28852895msgstr ""
28862896
2887- #: ../../c-api/init.rst:2421
2897+ #: ../../c-api/init.rst:2429
28882898msgid ""
28892899"static PyObject *\n"
28902900"set_field(MyObject *self, PyObject *value)\n"
@@ -2896,7 +2906,7 @@ msgid ""
28962906"}"
28972907msgstr ""
28982908
2899- #: ../../c-api/init.rst:2430
2909+ #: ../../c-api/init.rst:2438
29002910msgid ""
29012911"In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which"
29022912" can call arbitrary code through an object's deallocation function. The "
@@ -2906,61 +2916,61 @@ msgid ""
29062916":c:func:`PyEval_SaveThread`."
29072917msgstr ""
29082918
2909- #: ../../c-api/init.rst:2438
2919+ #: ../../c-api/init.rst:2446
29102920msgid ""
29112921"Acquires the per-object lock for the object *op* and begins a critical "
29122922"section."
29132923msgstr ""
29142924
2915- #: ../../c-api/init.rst:2441 ../../c-api/init.rst:2455
2916- #: ../../c-api/init.rst:2470 ../../c-api/init.rst:2484
2925+ #: ../../c-api/init.rst:2449 ../../c-api/init.rst:2463
2926+ #: ../../c-api/init.rst:2478 ../../c-api/init.rst:2492
29172927msgid "In the free-threaded build, this macro expands to::"
29182928msgstr ""
29192929
2920- #: ../../c-api/init.rst:2443
2930+ #: ../../c-api/init.rst:2451
29212931msgid ""
29222932"{\n"
29232933" PyCriticalSection _py_cs;\n"
29242934" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))"
29252935msgstr ""
29262936
2927- #: ../../c-api/init.rst:2447 ../../c-api/init.rst:2476
2937+ #: ../../c-api/init.rst:2455 ../../c-api/init.rst:2484
29282938msgid "In the default build, this macro expands to ``{``."
29292939msgstr ""
29302940
2931- #: ../../c-api/init.rst:2453
2941+ #: ../../c-api/init.rst:2461
29322942msgid "Ends the critical section and releases the per-object lock."
29332943msgstr ""
29342944
2935- #: ../../c-api/init.rst:2457
2945+ #: ../../c-api/init.rst:2465
29362946msgid ""
29372947" PyCriticalSection_End(&_py_cs);\n"
29382948"}"
29392949msgstr ""
29402950
2941- #: ../../c-api/init.rst:2460 ../../c-api/init.rst:2489
2951+ #: ../../c-api/init.rst:2468 ../../c-api/init.rst:2497
29422952msgid "In the default build, this macro expands to ``}``."
29432953msgstr ""
29442954
2945- #: ../../c-api/init.rst:2466
2955+ #: ../../c-api/init.rst:2474
29462956msgid ""
29472957"Acquires the per-objects locks for the objects *a* and *b* and begins a "
29482958"critical section. The locks are acquired in a consistent order (lowest "
29492959"address first) to avoid lock ordering deadlocks."
29502960msgstr ""
29512961
2952- #: ../../c-api/init.rst:2472
2962+ #: ../../c-api/init.rst:2480
29532963msgid ""
29542964"{\n"
29552965" PyCriticalSection2 _py_cs2;\n"
29562966" PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))"
29572967msgstr ""
29582968
2959- #: ../../c-api/init.rst:2482
2969+ #: ../../c-api/init.rst:2490
29602970msgid "Ends the critical section and releases the per-object locks."
29612971msgstr ""
29622972
2963- #: ../../c-api/init.rst:2486
2973+ #: ../../c-api/init.rst:2494
29642974msgid ""
29652975" PyCriticalSection2_End(&_py_cs2);\n"
29662976"}"
0 commit comments