Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit00e488b

Browse files
pydoc-zh-tw[bot]github-actions[bot]mattwang44
authored
Sync with CPython 3.13 (#1140)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>Co-authored-by: Matt Wang <mattwang44@gmail.com>
1 parent4f4b102 commit00e488b

File tree

16 files changed

+2258
-2087
lines changed

16 files changed

+2258
-2087
lines changed

‎c-api/init.po‎

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version:Python 3.13\n"
99
"Report-Msgid-Bugs-To:\n"
10-
"POT-Creation-Date:2025-08-18 00:18+0000\n"
10+
"POT-Creation-Date:2025-08-27 00:15+0000\n"
1111
"PO-Revision-Date:2023-04-24 20:49+0800\n"
1212
"Last-Translator:Adrian Liaw <adrianliaw2000@gmail.com>\n"
1313
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -2874,23 +2874,33 @@ msgstr ""
28742874

28752875
#:../../c-api/init.rst:2399
28762876
msgid""
2877-
"Critical sections avoid deadlocks by implicitly suspending active critical "
2878-
"sections and releasing the locks during calls to :c:func:"
2879-
"`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, the most "
2880-
"recent critical section is resumed, and its locks reacquired. This means "
2881-
"the critical section API provides weaker guarantees than traditional locks "
2882-
"-- they are useful because their behavior is similar to the :term:`GIL`."
2877+
"Critical sections are intended to be used for custom types implemented in C-"
2878+
"API extensions. They should generally not be used with built-in types like :"
2879+
"class:`list` and :class:`dict` because their public C-APIs already use "
2880+
"critical sections internally, with the notable exception of :c:func:"
2881+
"`PyDict_Next`, which requires critical section to be acquired externally."
28832882
msgstr""
28842883

28852884
#:../../c-api/init.rst:2406
28862885
msgid""
2886+
"Critical sections avoid deadlocks by implicitly suspending active critical "
2887+
"sections, hence, they do not provide exclusive access such as provided by "
2888+
"traditional locks like :c:type:`PyMutex`. When a critical section is "
2889+
"started, the per-object lock for the object is acquired. If the code "
2890+
"executed inside the critical section calls C-API functions then it can "
2891+
"suspend the critical section thereby releasing the per-object lock, so other "
2892+
"threads can acquire the per-object lock for the same object."
2893+
msgstr""
2894+
2895+
#:../../c-api/init.rst:2414
2896+
msgid""
28872897
"The functions and structs used by the macros are exposed for cases where C "
28882898
"macros are not available. They should only be used as in the given macro "
28892899
"expansions. Note that the sizes and contents of the structures may change in "
28902900
"future Python versions."
28912901
msgstr""
28922902

2893-
#:../../c-api/init.rst:2413
2903+
#:../../c-api/init.rst:2421
28942904
msgid""
28952905
"Operations that need to lock two objects at once must use :c:macro:"
28962906
"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to "
@@ -2899,11 +2909,11 @@ msgid ""
28992909
"lock more than two objects at once."
29002910
msgstr""
29012911

2902-
#:../../c-api/init.rst:2419
2912+
#:../../c-api/init.rst:2427
29032913
msgid"Example usage::"
29042914
msgstr"範例用法: ::"
29052915

2906-
#:../../c-api/init.rst:2421
2916+
#:../../c-api/init.rst:2429
29072917
msgid""
29082918
"static PyObject *\n"
29092919
"set_field(MyObject *self, PyObject *value)\n"
@@ -2923,7 +2933,7 @@ msgstr ""
29232933
" Py_RETURN_NONE;\n"
29242934
"}"
29252935

2926-
#:../../c-api/init.rst:2430
2936+
#:../../c-api/init.rst:2438
29272937
msgid""
29282938
"In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which "
29292939
"can call arbitrary code through an object's deallocation function. The "
@@ -2933,18 +2943,18 @@ msgid ""
29332943
"`PyEval_SaveThread`."
29342944
msgstr""
29352945

2936-
#:../../c-api/init.rst:2438
2946+
#:../../c-api/init.rst:2446
29372947
msgid""
29382948
"Acquires the per-object lock for the object *op* and begins a critical "
29392949
"section."
29402950
msgstr""
29412951

2942-
#:../../c-api/init.rst:2441../../c-api/init.rst:2455
2943-
#:../../c-api/init.rst:2470../../c-api/init.rst:2484
2952+
#:../../c-api/init.rst:2449../../c-api/init.rst:2463
2953+
#:../../c-api/init.rst:2478../../c-api/init.rst:2492
29442954
msgid"In the free-threaded build, this macro expands to::"
29452955
msgstr""
29462956

2947-
#:../../c-api/init.rst:2443
2957+
#:../../c-api/init.rst:2451
29482958
msgid""
29492959
"{\n"
29502960
" PyCriticalSection _py_cs;\n"
@@ -2954,34 +2964,34 @@ msgstr ""
29542964
" PyCriticalSection _py_cs;\n"
29552965
" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))"
29562966

2957-
#:../../c-api/init.rst:2447../../c-api/init.rst:2476
2967+
#:../../c-api/init.rst:2455../../c-api/init.rst:2484
29582968
msgid"In the default build, this macro expands to ``{``."
29592969
msgstr""
29602970

2961-
#:../../c-api/init.rst:2453
2971+
#:../../c-api/init.rst:2461
29622972
msgid"Ends the critical section and releases the per-object lock."
29632973
msgstr""
29642974

2965-
#:../../c-api/init.rst:2457
2975+
#:../../c-api/init.rst:2465
29662976
msgid""
29672977
" PyCriticalSection_End(&_py_cs);\n"
29682978
"}"
29692979
msgstr""
29702980
" PyCriticalSection_End(&_py_cs);\n"
29712981
"}"
29722982

2973-
#:../../c-api/init.rst:2460../../c-api/init.rst:2489
2983+
#:../../c-api/init.rst:2468../../c-api/init.rst:2497
29742984
msgid"In the default build, this macro expands to ``}``."
29752985
msgstr""
29762986

2977-
#:../../c-api/init.rst:2466
2987+
#:../../c-api/init.rst:2474
29782988
msgid""
29792989
"Acquires the per-objects locks for the objects *a* and *b* and begins a "
29802990
"critical section. The locks are acquired in a consistent order (lowest "
29812991
"address first) to avoid lock ordering deadlocks."
29822992
msgstr""
29832993

2984-
#:../../c-api/init.rst:2472
2994+
#:../../c-api/init.rst:2480
29852995
msgid""
29862996
"{\n"
29872997
" PyCriticalSection2 _py_cs2;\n"
@@ -2991,11 +3001,11 @@ msgstr ""
29913001
" PyCriticalSection2 _py_cs2;\n"
29923002
" PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))"
29933003

2994-
#:../../c-api/init.rst:2482
3004+
#:../../c-api/init.rst:2490
29953005
msgid"Ends the critical section and releases the per-object locks."
29963006
msgstr""
29973007

2998-
#:../../c-api/init.rst:2486
3008+
#:../../c-api/init.rst:2494
29993009
msgid""
30003010
" PyCriticalSection2_End(&_py_cs2);\n"
30013011
"}"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp