Skip to content

Commit 13cc2e2

Browse files
authored
Merge branch 'python:3.12' into 3.12
2 parents 116574e + a6723dd commit 13cc2e2

File tree

3 files changed

+167
-37
lines changed

3 files changed

+167
-37
lines changed

howto/perf_profiling.po

+48-19
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
# SOME DESCRIPTIVE TITLE.
21
# Copyright (C) 2001-2023, Python Software Foundation
32
# This file is distributed under the same license as the Python package.
4-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
53
#
6-
#, fuzzy
4+
# Translators:
5+
# Matt Wang <mattwang44@gmail.com>, 2023
76
msgid ""
87
msgstr ""
98
"Project-Id-Version: Python 3.12\n"
109
"Report-Msgid-Bugs-To: \n"
1110
"POT-Creation-Date: 2023-11-16 00:03+0000\n"
12-
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14-
"Language-Team: LANGUAGE <LL@li.org>\n"
11+
"PO-Revision-Date: 2023-12-09 17:39+0800\n"
12+
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
13+
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
14+
"tw)\n"
1515
"Language: zh_TW\n"
1616
"MIME-Version: 1.0\n"
1717
"Content-Type: text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919

2020
#: ../../howto/perf_profiling.rst:7
2121
msgid "Python support for the Linux ``perf`` profiler"
22-
msgstr ""
22+
msgstr "Python 對 Linux ``perf`` 分析器的支援"
2323

2424
#: ../../howto/perf_profiling.rst:0
2525
msgid "author"
26-
msgstr ""
26+
msgstr "作者"
2727

2828
#: ../../howto/perf_profiling.rst:9
2929
msgid "Pablo Galindo"
30-
msgstr ""
30+
msgstr "Pablo Galindo"
3131

3232
#: ../../howto/perf_profiling.rst:11
3333
msgid ""
@@ -36,6 +36,9 @@ msgid ""
3636
"of your application. ``perf`` also has a very vibrant ecosystem of tools "
3737
"that aid with the analysis of the data that it produces."
3838
msgstr ""
39+
"`Linux 性能分析器 (Linux perf profiler) <https://perf.wiki.kernel.org>`_ 是一"
40+
"個非常強大的工具,可讓你分析並獲取有關應用程式的性能資訊。``perf`` 還擁有一個"
41+
"非常活躍的工具生態系統,有助於分析其生成的資料。"
3942

4043
#: ../../howto/perf_profiling.rst:17
4144
msgid ""
@@ -45,6 +48,9 @@ msgid ""
4548
"and file names of Python functions in your code will not appear in the "
4649
"output of ``perf``."
4750
msgstr ""
51+
"在 Python 應用程式中使用 ``perf`` 分析器的主要問題是 ``perf`` 僅獲取有關原生"
52+
"符號的資訊,即用 C 編寫的函式和程式的名稱。這表示程式碼中的 Python 函式名"
53+
"稱和檔案名稱不會出現在 ``perf`` 的輸出中。"
4854

4955
#: ../../howto/perf_profiling.rst:22
5056
msgid ""
@@ -55,6 +61,10 @@ msgid ""
5561
"will teach ``perf`` the relationship between this piece of code and the "
5662
"associated Python function using :doc:`perf map files <../c-api/perfmaps>`."
5763
msgstr ""
64+
"從 Python 3.12 開始,直譯器可以在特殊模式下執行,該模式允許 Python 函式出現"
65+
"在 ``perf`` 分析器的輸出中。啟用此模式後,直譯器將在執行每個 Python 函式之前"
66+
"插入 (interpose) 一小段動態編譯的程式碼,並使用 :doc:`perf map 檔案 <../c-"
67+
"api/perfmaps>`\\ 來告訴 ``perf`` 這段程式碼與相關聯的 Python 函式間的關係。"
5868

5969
#: ../../howto/perf_profiling.rst:31
6070
msgid ""
@@ -63,18 +73,21 @@ msgid ""
6373
"check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE`` to "
6474
"see if your system is supported."
6575
msgstr ""
76+
"目前對 ``perf`` 分析器的支援僅適用於 Linux 的特定架構上。檢查 "
77+
"``configure`` 建構步驟的輸出或檢查 ``python -m sysconfig | grep "
78+
"HAVE_PERF_TRAMPOLINE`` 的輸出來查看你的系統是否支援。"
6679

6780
#: ../../howto/perf_profiling.rst:36
6881
msgid "For example, consider the following script:"
69-
msgstr ""
82+
msgstr "例如,參考以下腳本:"
7083

7184
#: ../../howto/perf_profiling.rst:55
7285
msgid "We can run ``perf`` to sample CPU stack traces at 9999 hertz::"
73-
msgstr ""
86+
msgstr "我們可以執行 ``perf`` 以 9999 赫茲採樣 CPU 堆疊追蹤 (stack trace): ::"
7487

7588
#: ../../howto/perf_profiling.rst:59
7689
msgid "Then we can use ``perf report`` to analyze the data:"
77-
msgstr ""
90+
msgstr "然後我們可以使用 ``perf report`` 來分析資料:"
7891

7992
#: ../../howto/perf_profiling.rst:100
8093
msgid ""
@@ -84,15 +97,20 @@ msgid ""
8497
"functions use the same C function to evaluate bytecode so we cannot know "
8598
"which Python function corresponds to which bytecode-evaluating function."
8699
msgstr ""
100+
"如你所見,Python 函式未顯示在輸出中,僅顯示 ``_Py_Eval_EvalFrameDefault`` "
101+
"(為 Python 位元組碼 (bytecode) 求值的函式)。不幸的是,這不是很有用,因為所有 "
102+
"Python 函式都使用相同的 C 函式來替位元組碼求值,因此我們無法知道哪個 Python 函"
103+
"式是對應於哪個位元組碼計算函式。"
87104

88105
#: ../../howto/perf_profiling.rst:105
89106
msgid ""
90107
"Instead, if we run the same experiment with ``perf`` support enabled we get:"
91108
msgstr ""
109+
"作為替代,如果我們在啟用 ``perf`` 支援的情況下執行相同的實驗,我們會得到:"
92110

93111
#: ../../howto/perf_profiling.rst:152
94112
msgid "How to enable ``perf`` profiling support"
95-
msgstr ""
113+
msgstr "如何啟用 ``perf`` 分析支援"
96114

97115
#: ../../howto/perf_profiling.rst:154
98116
msgid ""
@@ -101,32 +119,37 @@ msgid ""
101119
"X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :"
102120
"func:`sys.deactivate_stack_trampoline`."
103121
msgstr ""
122+
"要啟用 ``perf`` 分析支援,可以在一開始就使用環境變數 :envvar:"
123+
"`PYTHONPERFSUPPORT` 或使用 :option:`-X perf <-X>` 選項,也可以使用 :func:"
124+
"`sys.activate_stack_trampoline` 和 :func:`sys.deactivate_stack_trampoline` 來"
125+
"動態啟用。"
104126

105127
#: ../../howto/perf_profiling.rst:160
106128
msgid ""
107129
"The :mod:`!sys` functions take precedence over the :option:`!-X` option, "
108130
"the :option:`!-X` option takes precedence over the environment variable."
109131
msgstr ""
132+
":mod:`!sys` 函式優先於 :option:`!-X` 選項、:option:`!-X` 選項優先於環境變數。"
110133

111134
#: ../../howto/perf_profiling.rst:163
112135
msgid "Example, using the environment variable::"
113-
msgstr ""
136+
msgstr "例如,使用環境變數: ::"
114137

115138
#: ../../howto/perf_profiling.rst:168
116139
msgid "Example, using the :option:`!-X` option::"
117-
msgstr ""
140+
msgstr "例如,使用 :option:`!-X` 選項: ::"
118141

119142
#: ../../howto/perf_profiling.rst:173
120143
msgid "Example, using the :mod:`sys` APIs in file :file:`example.py`:"
121-
msgstr ""
144+
msgstr "例如,在 :file:`example.py` 檔案中使用 :mod:`sys` API:"
122145

123146
#: ../../howto/perf_profiling.rst:185
124147
msgid "...then::"
125-
msgstr ""
148+
msgstr "...然後: ::"
126149

127150
#: ../../howto/perf_profiling.rst:192
128151
msgid "How to obtain the best results"
129-
msgstr ""
152+
msgstr "如何獲得最佳結果"
130153

131154
#: ../../howto/perf_profiling.rst:194
132155
msgid ""
@@ -137,15 +160,21 @@ msgid ""
137160
"dynamically generated it doesn't have any DWARF debugging information "
138161
"available."
139162
msgstr ""
163+
"為了獲得最佳結果,應使用 ``CFLAGS=\"-fno-omit-frame-pointer -mno-omit-leaf-"
164+
"frame-pointer\"`` 來進行 Python 編譯,因為這能允許分析器僅使用 frame 指標而不"
165+
"是 DWARF 除錯資訊來解析 (unwind)。這是因為,由於插入以允許 ``perf`` 支援的程式碼是動"
166+
"態生成的,因此它沒有任何可用的 DWARF 除錯資訊。"
140167

141168
#: ../../howto/perf_profiling.rst:201
142169
msgid ""
143170
"You can check if your system has been compiled with this flag by running::"
144-
msgstr ""
171+
msgstr "你可以透過執行以下指令來檢查你的系統是否已使用此旗標進行編譯: ::"
145172

146173
#: ../../howto/perf_profiling.rst:205
147174
msgid ""
148175
"If you don't see any output it means that your interpreter has not been "
149176
"compiled with frame pointers and therefore it may not be able to show Python "
150177
"functions in the output of ``perf``."
151178
msgstr ""
179+
"如果你沒有看到任何輸出,則表示你的直譯器尚未使用 frame 指標進行編譯,因此它"
180+
"可能無法在 ``perf`` 的輸出中顯示 Python 函式。"

library/io.po

+17-4
Original file line numberDiff line numberDiff line change
@@ -652,63 +652,76 @@ msgstr "為了方便起見,允許多次呼叫這個方法;然而,只有第
652652

653653
#: ../../library/io.rst:362
654654
msgid "``True`` if the stream is closed."
655-
msgstr ""
655+
msgstr "如果串流已關閉,則為 ``True``。"
656656

657657
#: ../../library/io.rst:366
658658
msgid ""
659659
"Return the underlying file descriptor (an integer) of the stream if it "
660660
"exists. An :exc:`OSError` is raised if the IO object does not use a file "
661661
"descriptor."
662662
msgstr ""
663+
"如果串流存在,則回傳其底層的檔案描述器(一個整數)。如果 IO 物件不使用檔案描"
664+
"述器,則會引發一個 :exc:`OSError` 例外。"
663665

664666
#: ../../library/io.rst:372
665667
msgid ""
666668
"Flush the write buffers of the stream if applicable. This does nothing for "
667669
"read-only and non-blocking streams."
668670
msgstr ""
671+
"如果適用,清空串流的寫入緩衝區。對於唯讀和非阻塞串流,此操作不會執行任何操"
672+
"作。"
669673

670674
#: ../../library/io.rst:377
671675
msgid ""
672676
"Return ``True`` if the stream is interactive (i.e., connected to a terminal/"
673677
"tty device)."
674-
msgstr ""
678+
msgstr "如果串流是互動式的(即連接到終端機/tty 設備),則回傳 ``True``。"
675679

676680
#: ../../library/io.rst:382
677681
msgid ""
678682
"Return ``True`` if the stream can be read from. If ``False``, :meth:`!read` "
679683
"will raise :exc:`OSError`."
680684
msgstr ""
685+
"如果串流可以被讀取,則回傳 ``True``。如果是 ``False``,:meth:`!read` 將會引"
686+
"發 :exc:`OSError` 例外。"
681687

682688
#: ../../library/io.rst:387
683689
msgid ""
684690
"Read and return one line from the stream. If *size* is specified, at most "
685691
"*size* bytes will be read."
686-
msgstr ""
692+
msgstr "從串流讀取並回傳一行。如果指定了 *size*,則最多讀取 *size* 個位元組。"
687693

688694
#: ../../library/io.rst:390
689695
msgid ""
690696
"The line terminator is always ``b'\\n'`` for binary files; for text files, "
691697
"the *newline* argument to :func:`open` can be used to select the line "
692698
"terminator(s) recognized."
693699
msgstr ""
700+
"對於二進位檔案,行結束符總是 ``b'\\n'``;對於文字檔案,可以使用 :func:`open` "
701+
"函式的 *newline* 引數來選擇識別的行結束符號。"
694702

695703
#: ../../library/io.rst:396
696704
msgid ""
697705
"Read and return a list of lines from the stream. *hint* can be specified to "
698706
"control the number of lines read: no more lines will be read if the total "
699707
"size (in bytes/characters) of all lines so far exceeds *hint*."
700708
msgstr ""
709+
"從串流讀取並回傳一個含有一或多行的 list。可以指定 *hint* 來控制讀取的行數:如"
710+
"果到目前為止所有行的總大小(以位元組/字元計)超過 *hint*,則不會再讀取更多"
711+
"行。"
701712

702713
#: ../../library/io.rst:400
703714
msgid ""
704715
"*hint* values of ``0`` or less, as well as ``None``, are treated as no hint."
705-
msgstr ""
716+
msgstr "*hint* 值為 ``0`` 或更小,以及 ``None``,都被視為沒有提供 hint。"
706717

707718
#: ../../library/io.rst:403
708719
msgid ""
709720
"Note that it's already possible to iterate on file objects using ``for line "
710721
"in file: ...`` without calling :meth:`!file.readlines`."
711722
msgstr ""
723+
"請注意,已經可以使用 ``for line in file: ...`` 在檔案物件上進行疊代,而不一定"
724+
"需要呼叫 :meth:`!file.readlines`。"
712725

713726
#: ../../library/io.rst:408
714727
msgid ""

0 commit comments

Comments
 (0)