@@ -13,7 +13,7 @@ msgid ""
1313msgstr ""
1414"Project-Id-Version : Python 3.14\n "
1515"Report-Msgid-Bugs-To : \n "
16- "POT-Creation-Date : 2025-08-21 14:19 +0000\n "
16+ "POT-Creation-Date : 2025-08-29 14:17 +0000\n "
1717"PO-Revision-Date : 2025-08-02 17:33+0000\n "
1818"Last-Translator : Rafael Fontenelle <rffontenelle@gmail.com>, 2025\n "
1919"Language-Team : Portuguese (Brazil) (https://app.transifex.com/python-doc/ "
@@ -3364,32 +3364,42 @@ msgstr ""
33643364
33653365#: ../../c-api/init.rst:2466
33663366msgid ""
3367- "Critical sections avoid deadlocks by implicitly suspending active critical "
3368- "sections and releasing the locks during calls to :c:func:"
3369- "`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, the most "
3370- "recent critical section is resumed, and its locks reacquired. This means "
3371- "the critical section API provides weaker guarantees than traditional locks "
3372- "-- they are useful because their behavior is similar to the :term:`GIL`."
3367+ "Critical sections are intended to be used for custom types implemented in C-"
3368+ "API extensions. They should generally not be used with built-in types like :"
3369+ "class:`list` and :class:`dict` because their public C-APIs already use "
3370+ "critical sections internally, with the notable exception of :c:func:"
3371+ "`PyDict_Next`, which requires critical section to be acquired externally."
33733372msgstr ""
33743373
33753374#: ../../c-api/init.rst:2473
33763375msgid ""
3376+ "Critical sections avoid deadlocks by implicitly suspending active critical "
3377+ "sections, hence, they do not provide exclusive access such as provided by "
3378+ "traditional locks like :c:type:`PyMutex`. When a critical section is "
3379+ "started, the per-object lock for the object is acquired. If the code "
3380+ "executed inside the critical section calls C-API functions then it can "
3381+ "suspend the critical section thereby releasing the per-object lock, so other "
3382+ "threads can acquire the per-object lock for the same object."
3383+ msgstr ""
3384+
3385+ #: ../../c-api/init.rst:2481
3386+ msgid ""
33773387"Variants that accept :c:type:`PyMutex` pointers rather than Python objects "
33783388"are also available. Use these variants to start a critical section in a "
33793389"situation where there is no :c:type:`PyObject` -- for example, when working "
33803390"with a C type that does not extend or wrap :c:type:`PyObject` but still "
33813391"needs to call into the C API in a manner that might lead to deadlocks."
33823392msgstr ""
33833393
3384- #: ../../c-api/init.rst:2479
3394+ #: ../../c-api/init.rst:2487
33853395msgid ""
33863396"The functions and structs used by the macros are exposed for cases where C "
33873397"macros are not available. They should only be used as in the given macro "
33883398"expansions. Note that the sizes and contents of the structures may change in "
33893399"future Python versions."
33903400msgstr ""
33913401
3392- #: ../../c-api/init.rst:2486
3402+ #: ../../c-api/init.rst:2494
33933403msgid ""
33943404"Operations that need to lock two objects at once must use :c:macro:"
33953405"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to "
@@ -3398,11 +3408,11 @@ msgid ""
33983408"lock more than two objects at once."
33993409msgstr ""
34003410
3401- #: ../../c-api/init.rst:2492
3411+ #: ../../c-api/init.rst:2500
34023412msgid "Example usage::"
34033413msgstr "Exemplo de uso::"
34043414
3405- #: ../../c-api/init.rst:2494
3415+ #: ../../c-api/init.rst:2502
34063416msgid ""
34073417"static PyObject *\n"
34083418"set_field(MyObject *self, PyObject *value)\n"
@@ -3414,7 +3424,7 @@ msgid ""
34143424"}"
34153425msgstr ""
34163426
3417- #: ../../c-api/init.rst:2503
3427+ #: ../../c-api/init.rst:2511
34183428msgid ""
34193429"In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which "
34203430"can call arbitrary code through an object's deallocation function. The "
@@ -3424,100 +3434,100 @@ msgid ""
34243434"`PyEval_SaveThread`."
34253435msgstr ""
34263436
3427- #: ../../c-api/init.rst:2511
3437+ #: ../../c-api/init.rst:2519
34283438msgid ""
34293439"Acquires the per-object lock for the object *op* and begins a critical "
34303440"section."
34313441msgstr ""
34323442
3433- #: ../../c-api/init.rst:2514 ../../c-api/init.rst:2528
3434- #: ../../c-api/init.rst:2545 ../../c-api/init.rst:2560
3435- #: ../../c-api/init.rst:2574 ../../c-api/init.rst:2591
3443+ #: ../../c-api/init.rst:2522 ../../c-api/init.rst:2536
3444+ #: ../../c-api/init.rst:2553 ../../c-api/init.rst:2568
3445+ #: ../../c-api/init.rst:2582 ../../c-api/init.rst:2599
34363446msgid "In the free-threaded build, this macro expands to::"
34373447msgstr ""
34383448
3439- #: ../../c-api/init.rst:2516
3449+ #: ../../c-api/init.rst:2524
34403450msgid ""
34413451"{\n"
34423452" PyCriticalSection _py_cs;\n"
34433453" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))"
34443454msgstr ""
34453455
3446- #: ../../c-api/init.rst:2520 ../../c-api/init.rst:2566
3456+ #: ../../c-api/init.rst:2528 ../../c-api/init.rst:2574
34473457msgid "In the default build, this macro expands to ``{``."
34483458msgstr ""
34493459
3450- #: ../../c-api/init.rst:2526
3460+ #: ../../c-api/init.rst:2534
34513461msgid "Locks the mutex *m* and begins a critical section."
34523462msgstr ""
34533463
3454- #: ../../c-api/init.rst:2530
3464+ #: ../../c-api/init.rst:2538
34553465msgid ""
34563466"{\n"
34573467" PyCriticalSection _py_cs;\n"
34583468" PyCriticalSection_BeginMutex(&_py_cs, m)"
34593469msgstr ""
34603470
3461- #: ../../c-api/init.rst:2534
3471+ #: ../../c-api/init.rst:2542
34623472msgid ""
34633473"Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION`, there is no cast for "
34643474"the argument of the macro - it must be a :c:type:`PyMutex` pointer."
34653475msgstr ""
34663476
3467- #: ../../c-api/init.rst:2537 ../../c-api/init.rst:2583
3477+ #: ../../c-api/init.rst:2545 ../../c-api/init.rst:2591
34683478msgid "On the default build, this macro expands to ``{``."
34693479msgstr ""
34703480
3471- #: ../../c-api/init.rst:2543
3481+ #: ../../c-api/init.rst:2551
34723482msgid "Ends the critical section and releases the per-object lock."
34733483msgstr ""
34743484
3475- #: ../../c-api/init.rst:2547
3485+ #: ../../c-api/init.rst:2555
34763486msgid ""
34773487" PyCriticalSection_End(&_py_cs);\n"
34783488"}"
34793489msgstr ""
34803490
3481- #: ../../c-api/init.rst:2550 ../../c-api/init.rst:2596
3491+ #: ../../c-api/init.rst:2558 ../../c-api/init.rst:2604
34823492msgid "In the default build, this macro expands to ``}``."
34833493msgstr ""
34843494
3485- #: ../../c-api/init.rst:2556
3495+ #: ../../c-api/init.rst:2564
34863496msgid ""
34873497"Acquires the per-objects locks for the objects *a* and *b* and begins a "
34883498"critical section. The locks are acquired in a consistent order (lowest "
34893499"address first) to avoid lock ordering deadlocks."
34903500msgstr ""
34913501
3492- #: ../../c-api/init.rst:2562
3502+ #: ../../c-api/init.rst:2570
34933503msgid ""
34943504"{\n"
34953505" PyCriticalSection2 _py_cs2;\n"
34963506" PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))"
34973507msgstr ""
34983508
3499- #: ../../c-api/init.rst:2572
3509+ #: ../../c-api/init.rst:2580
35003510msgid "Locks the mutexes *m1* and *m2* and begins a critical section."
35013511msgstr ""
35023512
3503- #: ../../c-api/init.rst:2576
3513+ #: ../../c-api/init.rst:2584
35043514msgid ""
35053515"{\n"
35063516" PyCriticalSection2 _py_cs2;\n"
35073517" PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)"
35083518msgstr ""
35093519
3510- #: ../../c-api/init.rst:2580
3520+ #: ../../c-api/init.rst:2588
35113521msgid ""
35123522"Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for "
35133523"the arguments of the macro - they must be :c:type:`PyMutex` pointers."
35143524msgstr ""
35153525
3516- #: ../../c-api/init.rst:2589
3526+ #: ../../c-api/init.rst:2597
35173527msgid "Ends the critical section and releases the per-object locks."
35183528msgstr ""
35193529
3520- #: ../../c-api/init.rst:2593
3530+ #: ../../c-api/init.rst:2601
35213531msgid ""
35223532" PyCriticalSection2_End(&_py_cs2);\n"
35233533"}"
0 commit comments