44# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55#
66# Translators:
7- # Rafael Fontenelle <rffontenelle@gmail.com> , 2025
7+ # python-doc bot , 2025
88#
99#, fuzzy
1010msgid ""
1111msgstr ""
1212"Project-Id-Version : Python 3.14\n "
1313"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2025-06-27 14:20 +0000\n "
15- "PO-Revision-Date : 2025-07-18 18:48 +0000\n "
16- "Last-Translator : Rafael Fontenelle <rffontenelle@gmail.com> , 2025\n "
14+ "POT-Creation-Date : 2025-08-29 14:17 +0000\n "
15+ "PO-Revision-Date : 2025-08-02 17:33 +0000\n "
16+ "Last-Translator : python-doc bot , 2025\n "
1717"Language-Team : Russian (https://app.transifex.com/python-doc/teams/5390/ru/)\n "
1818"MIME-Version : 1.0\n "
1919"Content-Type : text/plain; charset=UTF-8\n "
@@ -2959,38 +2959,68 @@ msgid ""
29592959"issue a fatal error."
29602960msgstr ""
29612961
2962- #: ../../c-api/init.rst:2447
2962+ #: ../../c-api/init.rst:2446
2963+ msgid "Returns non-zero if the mutex *m* is currently locked, zero otherwise."
2964+ msgstr ""
2965+
2966+ #: ../../c-api/init.rst:2450
2967+ msgid ""
2968+ "This function is intended for use in assertions and debugging only and "
2969+ "should not be used to make concurrency control decisions, as the lock state "
2970+ "may change immediately after the check."
2971+ msgstr ""
2972+
2973+ #: ../../c-api/init.rst:2459
29632974msgid "Python Critical Section API"
29642975msgstr ""
29652976
2966- #: ../../c-api/init.rst:2449
2977+ #: ../../c-api/init.rst:2461
29672978msgid ""
29682979"The critical section API provides a deadlock avoidance layer on top of per-"
29692980"object locks for :term:`free-threaded <free threading>` CPython. They are "
29702981"intended to replace reliance on the :term:`global interpreter lock`, and are"
29712982" no-ops in versions of Python with the global interpreter lock."
29722983msgstr ""
29732984
2974- #: ../../c-api/init.rst:2454
2985+ #: ../../c-api/init.rst:2466
2986+ msgid ""
2987+ "Critical sections are intended to be used for custom types implemented in "
2988+ "C-API extensions. They should generally not be used with built-in types like"
2989+ " :class:`list` and :class:`dict` because their public C-APIs already use "
2990+ "critical sections internally, with the notable exception of "
2991+ ":c:func:`PyDict_Next`, which requires critical section to be acquired "
2992+ "externally."
2993+ msgstr ""
2994+
2995+ #: ../../c-api/init.rst:2473
29752996msgid ""
29762997"Critical sections avoid deadlocks by implicitly suspending active critical "
2977- "sections and releasing the locks during calls to "
2978- ":c:func:`PyEval_SaveThread `. When :c:func:`PyEval_RestoreThread` is called, "
2979- "the most recent critical section is resumed, and its locks reacquired. This "
2980- " means the critical section API provides weaker guarantees than traditional "
2981- "locks -- they are useful because their behavior is similar to the "
2982- ":term:`GIL` ."
2998+ "sections, hence, they do not provide exclusive access such as provided by "
2999+ "traditional locks like :c:type:`PyMutex `. When a critical section is "
3000+ "started, the per-object lock for the object is acquired. If the code "
3001+ "executed inside the critical section calls C- API functions then it can "
3002+ "suspend the critical section thereby releasing the per-object lock, so other "
3003+ " threads can acquire the per-object lock for the same object ."
29833004msgstr ""
29843005
2985- #: ../../c-api/init.rst:2461
3006+ #: ../../c-api/init.rst:2481
3007+ msgid ""
3008+ "Variants that accept :c:type:`PyMutex` pointers rather than Python objects "
3009+ "are also available. Use these variants to start a critical section in a "
3010+ "situation where there is no :c:type:`PyObject` -- for example, when working "
3011+ "with a C type that does not extend or wrap :c:type:`PyObject` but still "
3012+ "needs to call into the C API in a manner that might lead to deadlocks."
3013+ msgstr ""
3014+
3015+ #: ../../c-api/init.rst:2487
29863016msgid ""
29873017"The functions and structs used by the macros are exposed for cases where C "
29883018"macros are not available. They should only be used as in the given macro "
29893019"expansions. Note that the sizes and contents of the structures may change in"
29903020" future Python versions."
29913021msgstr ""
29923022
2993- #: ../../c-api/init.rst:2468
3023+ #: ../../c-api/init.rst:2494
29943024msgid ""
29953025"Operations that need to lock two objects at once must use "
29963026":c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical "
@@ -2999,11 +3029,11 @@ msgid ""
29993029"a way to lock more than two objects at once."
30003030msgstr ""
30013031
3002- #: ../../c-api/init.rst:2474
3032+ #: ../../c-api/init.rst:2500
30033033msgid "Example usage::"
30043034msgstr ""
30053035
3006- #: ../../c-api/init.rst:2476
3036+ #: ../../c-api/init.rst:2502
30073037msgid ""
30083038"static PyObject *\n"
30093039"set_field(MyObject *self, PyObject *value)\n"
@@ -3015,7 +3045,7 @@ msgid ""
30153045"}"
30163046msgstr ""
30173047
3018- #: ../../c-api/init.rst:2485
3048+ #: ../../c-api/init.rst:2511
30193049msgid ""
30203050"In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which"
30213051" can call arbitrary code through an object's deallocation function. The "
@@ -3025,61 +3055,100 @@ msgid ""
30253055":c:func:`PyEval_SaveThread`."
30263056msgstr ""
30273057
3028- #: ../../c-api/init.rst:2493
3058+ #: ../../c-api/init.rst:2519
30293059msgid ""
30303060"Acquires the per-object lock for the object *op* and begins a critical "
30313061"section."
30323062msgstr ""
30333063
3034- #: ../../c-api/init.rst:2496 ../../c-api/init.rst:2510
3035- #: ../../c-api/init.rst:2525 ../../c-api/init.rst:2539
3064+ #: ../../c-api/init.rst:2522 ../../c-api/init.rst:2536
3065+ #: ../../c-api/init.rst:2553 ../../c-api/init.rst:2568
3066+ #: ../../c-api/init.rst:2582 ../../c-api/init.rst:2599
30363067msgid "In the free-threaded build, this macro expands to::"
30373068msgstr ""
30383069
3039- #: ../../c-api/init.rst:2498
3070+ #: ../../c-api/init.rst:2524
30403071msgid ""
30413072"{\n"
30423073" PyCriticalSection _py_cs;\n"
30433074" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))"
30443075msgstr ""
30453076
3046- #: ../../c-api/init.rst:2502 ../../c-api/init.rst:2531
3077+ #: ../../c-api/init.rst:2528 ../../c-api/init.rst:2574
30473078msgid "In the default build, this macro expands to ``{``."
30483079msgstr ""
30493080
3050- #: ../../c-api/init.rst:2508
3081+ #: ../../c-api/init.rst:2534
3082+ msgid "Locks the mutex *m* and begins a critical section."
3083+ msgstr ""
3084+
3085+ #: ../../c-api/init.rst:2538
3086+ msgid ""
3087+ "{\n"
3088+ " PyCriticalSection _py_cs;\n"
3089+ " PyCriticalSection_BeginMutex(&_py_cs, m)"
3090+ msgstr ""
3091+
3092+ #: ../../c-api/init.rst:2542
3093+ msgid ""
3094+ "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION`, there is no cast for "
3095+ "the argument of the macro - it must be a :c:type:`PyMutex` pointer."
3096+ msgstr ""
3097+
3098+ #: ../../c-api/init.rst:2545 ../../c-api/init.rst:2591
3099+ msgid "On the default build, this macro expands to ``{``."
3100+ msgstr ""
3101+
3102+ #: ../../c-api/init.rst:2551
30513103msgid "Ends the critical section and releases the per-object lock."
30523104msgstr ""
30533105
3054- #: ../../c-api/init.rst:2512
3106+ #: ../../c-api/init.rst:2555
30553107msgid ""
30563108" PyCriticalSection_End(&_py_cs);\n"
30573109"}"
30583110msgstr ""
30593111
3060- #: ../../c-api/init.rst:2515 ../../c-api/init.rst:2544
3112+ #: ../../c-api/init.rst:2558 ../../c-api/init.rst:2604
30613113msgid "In the default build, this macro expands to ``}``."
30623114msgstr ""
30633115
3064- #: ../../c-api/init.rst:2521
3116+ #: ../../c-api/init.rst:2564
30653117msgid ""
30663118"Acquires the per-objects locks for the objects *a* and *b* and begins a "
30673119"critical section. The locks are acquired in a consistent order (lowest "
30683120"address first) to avoid lock ordering deadlocks."
30693121msgstr ""
30703122
3071- #: ../../c-api/init.rst:2527
3123+ #: ../../c-api/init.rst:2570
30723124msgid ""
30733125"{\n"
30743126" PyCriticalSection2 _py_cs2;\n"
30753127" PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))"
30763128msgstr ""
30773129
3078- #: ../../c-api/init.rst:2537
3130+ #: ../../c-api/init.rst:2580
3131+ msgid "Locks the mutexes *m1* and *m2* and begins a critical section."
3132+ msgstr ""
3133+
3134+ #: ../../c-api/init.rst:2584
3135+ msgid ""
3136+ "{\n"
3137+ " PyCriticalSection2 _py_cs2;\n"
3138+ " PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)"
3139+ msgstr ""
3140+
3141+ #: ../../c-api/init.rst:2588
3142+ msgid ""
3143+ "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for"
3144+ " the arguments of the macro - they must be :c:type:`PyMutex` pointers."
3145+ msgstr ""
3146+
3147+ #: ../../c-api/init.rst:2597
30793148msgid "Ends the critical section and releases the per-object locks."
30803149msgstr ""
30813150
3082- #: ../../c-api/init.rst:2541
3151+ #: ../../c-api/init.rst:2601
30833152msgid ""
30843153" PyCriticalSection2_End(&_py_cs2);\n"
30853154"}"
0 commit comments