@@ -49,8 +49,8 @@ msgid ""
4949"nothing to do with Python --- instead, some parts of the application "
5050"occasionally call the Python interpreter to run some Python code."
5151msgstr ""
52- "嵌入 Python 與擴充它類似 ,但不完全相同。差別在於當你擴充 Python 時,應用程式"
53- "的主程式仍然是 Python 直譯器,而如果你嵌入 Python,主程式可能與 Python "
52+ "嵌入 Python 與擴充 Python 類似 ,但不完全相同。差別在於當你擴充 Python 時,應用程式"
53+ "的主程式仍然是 Python 直譯器,而當你嵌入 Python,主程式可能與 Python "
5454"無關 — 相反地,應用程式的某些部分偶爾會呼叫 Python 直譯器來執行一些 Python "
5555"程式碼。"
5656
@@ -65,7 +65,7 @@ msgid ""
6565msgstr ""
6666"所以如果你要嵌入 Python,你要提供自己的主程式。這個主程式必須做的事情之一是"
6767"初始化 Python 直譯器,或至少必須要呼叫函式 :c:func:`Py_Initialize`。還有一些"
68- "可選的呼叫來傳遞命令列引數給 Python。然後你可以在應用程式的任何部分呼叫直譯 "
68+ "可選的呼叫來傳遞命令列引數給 Python。然後你就可以在應用程式的任何部分呼叫直譯 "
6969"器。"
7070
7171#: ../../extending/embedding.rst:32
@@ -77,7 +77,7 @@ msgid ""
7777"level operations described in the previous chapters to construct and use "
7878"Python objects."
7979msgstr ""
80- "有幾種不同的方式來呼叫直譯器:你可以傳遞一個包含 Python 敘述的字串給 :c:func:"
80+ "有幾種不同的方式來呼叫直譯器:你可以傳遞一個包含 Python 陳述式的字串給 :c:func:"
8181"`PyRun_SimpleString`,或者你可以傳遞一個 stdio 檔案指標和檔案名稱(僅用於錯誤"
8282"訊息中的識別)給 :c:func:`PyRun_SimpleFile`。你也可以呼叫前面章節中描述的較低"
8383"層級操作來建構和使用 Python 物件。"
@@ -105,7 +105,7 @@ msgid ""
105105"used to perform some operation on a file. ::"
106106msgstr ""
107107"嵌入 Python 最簡單的形式是使用非常高階的介面。此介面用於執行 Python 腳本而"
108- "無需直接與應用程式互動。這例如可以用來對檔案執行一些操作 。 ::"
108+ "無需直接與應用程式互動。例如這可以用來對檔案執行一些操作 。 ::"
109109
110110#: ../../extending/embedding.rst:56
111111msgid ""
@@ -187,7 +187,7 @@ msgid ""
187187"string-and-buffers` for a description of this macro."
188188msgstr ""
189189"``#define PY_SSIZE_T_CLEAN`` 被用來指示某些 API 應該使用 ``Py_ssize_t`` 而不是 "
190- "``int``。從 Python 3.13 開始不再必要,但我們在這裡保留它以維持向後相容性 。"
190+ "``int``。從 Python 3.13 開始不再需要它,但我們保留它以維持向後相容性 。"
191191"關於此巨集的描述請參閱 :ref:`arg-parsing-string-and-buffers`。"
192192
193193#: ../../extending/embedding.rst:97
@@ -204,8 +204,8 @@ msgid ""
204204"`PyRun_SimpleFile` function, which saves you the trouble of allocating "
205205"memory space and loading the file contents."
206206msgstr ""
207- "設定 :c:member:`PyConfig.program_name` 應該在 :c:func:`Py_InitializeFromConfig` "
208- "之前呼叫 ,以告知直譯器 Python run-time 函式庫的路徑。接下來,Python 直譯器用 :c:"
207+ ":c:member:`PyConfig.program_name` 的設定應該在 :c:func:`Py_InitializeFromConfig` "
208+ "前呼叫 ,以告知直譯器 Python run-time 函式庫的路徑。接下來,Python 直譯器會用 :c:"
209209"func:`Py_Initialize` 初始化,然後執行一個硬編碼的 Python 腳本來印出日期和時間。"
210210"之後,:c:func:`Py_FinalizeEx` 呼叫會關閉直譯器,接著程式結束。在真實的程式中,"
211211"你可能想要從另一個來源取得 Python 腳本,或許是文字編輯器例程、檔案或資料庫。"
@@ -224,9 +224,9 @@ msgid ""
224224"calls. At the cost of having to write more C code, you can achieve almost "
225225"anything."
226226msgstr ""
227- "高階介面讓你能夠從應用程式中執行任意的 Python 程式碼片段,但至少可以說交換資料 "
228- "值是相當麻煩的。如果你想要這樣做,你應該使用較低階的呼叫。以必須撰寫更多 C "
229- "程式碼為代價,你幾乎可以達成任何事情 。"
227+ "高階介面讓你能夠從應用程式中執行任意的 Python 程式碼片段,但交換資料 "
228+ "值的過程可以說相當繁瑣。如果你想進行這類操作,應該使用較低階的呼叫。 "
229+ "雖然需要撰寫更多的 C 程式碼,但幾乎可以實現任何功能 。"
230230
231231#: ../../extending/embedding.rst:119
232232msgid ""
@@ -235,17 +235,17 @@ msgid ""
235235"previous chapters are still valid. To show this, consider what the extension "
236236"code from Python to C really does:"
237237msgstr ""
238- "應該注意的是,儘管意圖不同,擴充 Python 和嵌入 Python 其實是相當相同的活動。 "
239- "前面章節討論的大部分主題仍然有效 。為了說明這一點,考慮從 Python 到 C 的擴充 "
240- "程式碼真正做了什麼 :"
238+ "需要注意的是,雖然目的不同,但擴充 Python 與嵌入 Python 其實是非常相似的操作, "
239+ "前面章節討論的大多數主題在這裡同樣適用 。為了說明這一點,請思考從 Python 到 C "
240+ "的擴充程式碼實際上做了什麼 :"
241241
242242#: ../../extending/embedding.rst:124
243243msgid "Convert data values from Python to C,"
244244msgstr "將資料值從 Python 轉換為 C,"
245245
246246#: ../../extending/embedding.rst:126
247247msgid "Perform a function call to a C routine using the converted values, and"
248- msgstr "使用轉換後的值對 C 例程執行函式呼叫,以及 "
248+ msgstr "使用轉換後的值呼叫 C 例程,並 "
249249
250250#: ../../extending/embedding.rst:128
251251msgid "Convert the data values from the call from C to Python."
@@ -263,7 +263,7 @@ msgstr "將資料值從 C 轉換為 Python,"
263263msgid ""
264264"Perform a function call to a Python interface routine using the converted "
265265"values, and"
266- msgstr "使用轉換後的值對 Python 介面例程執行函式呼叫,以及 "
266+ msgstr "使用轉換後的值呼叫 Python 介面例程,並 "
267267
268268#: ../../extending/embedding.rst:137
269269msgid "Convert the data values from the call from Python to C."
@@ -276,8 +276,8 @@ msgid ""
276276"is the routine that you call between both data conversions. When extending, "
277277"you call a C routine, when embedding, you call a Python routine."
278278msgstr ""
279- "如你所見,資料轉換步驟只是被交換來配合跨語言傳輸的不同方向。唯一的差別是你在 "
280- "兩個資料轉換之間呼叫的例程。當擴充時,你呼叫 C 例程,當嵌入時,你呼叫 Python "
279+ "如你所見,資料轉換的步驟只是互換了順序,以配合跨語言傳遞方向的不同。唯一的差別在於 "
280+ "兩個資料轉換之間所呼叫的例程:在擴充時你呼叫的是 C 例程;在嵌入時則呼叫 Python "
281281"例程。"
282282
283283#: ../../extending/embedding.rst:144
@@ -287,9 +287,9 @@ msgid ""
287287"be understood. Since these aspects do not differ from extending the "
288288"interpreter, you can refer to earlier chapters for the required information."
289289msgstr ""
290- "本章不會討論如何將資料從 Python 轉換為 C 以及反之。此外,假設已經理解參考的 "
291- "正確使用和錯誤處理。由於這些方面與擴充直譯器沒有不同,你可以參考前面的章節 "
292- "來取得所需資訊 。"
290+ "本章不會討論如何將資料從 Python 轉換為 C 或從 C 轉換回 Python,且假設讀者已經知道參照的 "
291+ "正確使用方式與錯誤處理。由於這些部分與擴充直譯器時相同, "
292+ "相關資訊可參考前面的章節 。"
293293
294294#: ../../extending/embedding.rst:153
295295msgid "Pure Embedding"
@@ -393,8 +393,8 @@ msgid ""
393393"(let's call the finished executable :program:`call`), and use it to execute "
394394"a Python script, such as:"
395395msgstr ""
396- "此程式碼使用 ``argv[1]`` 載入 Python 腳本,並呼叫 ``argv[2]`` 中命名的函式 。"
397- "其整數引數是 ``argv`` 陣列的其他值 。如果你 :ref:`編譯並連結 <compiling>` 此"
396+ "此程式碼使用 ``argv[1]`` 載入 Python 腳本,並呼叫 ``argv[2]`` 中所指定的函式 。"
397+ "其整數引數則來自 ``argv`` 陣列中的其他值 。如果你\\ :ref:`編譯並連結 <compiling>` 此"
398398"程式(我們稱完成的可執行檔為 :program:`call`),並用它來執行 Python 腳本,"
399399"例如:"
400400
@@ -434,8 +434,8 @@ msgid ""
434434"is for data conversion between Python and C, and for error reporting. The "
435435"interesting part with respect to embedding Python starts with ::"
436436msgstr ""
437- "雖然對於其功能而言程式相當龐大 ,但大部分的程式碼是用於 Python 和 C 之間的資料"
438- "轉換,以及錯誤回報。關於嵌入 Python 的有趣部分開始於 : ::"
437+ "雖然以其功能而言這個程式相當龐大 ,但大部分的程式碼是用於 Python 與 C 之間的資料"
438+ "轉換以及錯誤回報。至於與嵌入 Python 有關的重點部分,則從以下開始 : ::"
439439
440440#: ../../extending/embedding.rst:192
441441msgid ""
@@ -486,9 +486,9 @@ msgid ""
486486"proceeds by constructing a tuple of arguments as normal. The call to the "
487487"Python function is then made with::"
488488msgstr ""
489- "一旦腳本載入,我們要找的名稱使用 :c:func:`PyObject_GetAttrString` 檢索 。如果"
490- "名稱存在 ,且回傳的物件是可呼叫的,你可以安全地假設它是一個函式。程式接著以 "
491- "正常方式建構引數元組。對 Python 函式的呼叫接著以下面方式進行 ::"
489+ "腳本載入後,會使用 :c:func:`PyObject_GetAttrString` 來取得所需的名稱 。如果"
490+ "該名稱存在 ,且回傳的物件是可呼叫的,便可安全地假設它是一個函式。接著,程式會以 "
491+ "一般方式建立引數的元組。之後便以下列方式呼叫該 Python 函式: ::"
492492
493493#: ../../extending/embedding.rst:216
494494msgid "pValue = PyObject_CallObject(pFunc, pArgs);"
@@ -500,7 +500,7 @@ msgid ""
500500"reference to the return value of the function. Be sure to release the "
501501"reference after examining the value."
502502msgstr ""
503- "函式回傳時,``pValue`` 要不是 ``NULL`` 就是包含函式回傳值的參照。確保在檢查 "
503+ "函式回傳時,``pValue`` 要不是 ``NULL`` 就是包含函式回傳值的參照。請務必在檢查 "
504504"值之後釋放參照。"
505505
506506#: ../../extending/embedding.rst:226
@@ -518,10 +518,10 @@ msgid ""
518518"and write some glue code that gives Python access to those routines, just "
519519"like you would write a normal Python extension. For example::"
520520msgstr ""
521- "到目前為止,嵌入式 Python 直譯器無法存取應用程式本身的功能 。Python API 透過 "
522- "擴充嵌入式直譯器來允許這樣做 。也就是說,嵌入式直譯器被應用程式提供的例程所 "
523- "擴充。雖然聽起來複雜,但其實沒那麼糟。只要暫時忘記應用程式啟動 Python 直譯器"
524- "這件事。相反,把應用程式當作一組子程序, 並撰寫一些膠合程式碼讓 Python 存取 "
521+ "到目前為止,嵌入式 Python 直譯器尚無法存取應用程式本身的功能 。Python API 允許透過 "
522+ "擴充嵌入式直譯器來達成這點 。也就是說,嵌入式直譯器可以由應用程式所提供的例程加以 "
523+ "擴充。雖然聽起來複雜但其實並不難。只要暫時忘記是應用程式啟動了 Python 直譯器, "
524+ "改以將應用程式視為一組子程序, 並撰寫一些膠合程式碼讓 Python 能夠存取 "
525525"這些例程,就像你撰寫一般 Python 擴充一樣。例如: ::"
526526
527527#: ../../extending/embedding.rst:237
@@ -563,7 +563,7 @@ msgid ""
563563"the following two statements before the call to :c:func:`Py_Initialize`::"
564564msgstr ""
565565"在 :c:func:`main` 函式的正上方插入上述程式碼。同時,在呼叫 :c:func:"
566- "`Py_Initialize` 之前插入以下兩個敘述 ::"
566+ "`Py_Initialize` 之前插入以下兩個陳述式: ::"
567567
568568#: ../../extending/embedding.rst:270
569569msgid ""
@@ -579,8 +579,8 @@ msgid ""
579579"emb.numargs` function accessible to the embedded Python interpreter. With "
580580"these extensions, the Python script can do things like"
581581msgstr ""
582- "這兩行初始化 ``numargs`` 變數,並讓 :func:`!emb.numargs` 函式對嵌入式 Python "
583- "直譯器可用。有了這些擴充 ,Python 腳本可以執行以下操作 "
582+ "這兩行初始化 ``numargs`` 變數,並讓 :func:`!emb.numargs` 函式可供嵌入式 Python "
583+ "直譯器使用。有了這些擴充後 ,Python 腳本便可以執行像是以下的操作 "
584584
585585#: ../../extending/embedding.rst:277
586586msgid ""
@@ -624,8 +624,8 @@ msgid ""
624624"implemented as C dynamic extensions (:file:`.so` files) linked against it."
625625msgstr ""
626626"要找到傳遞給編譯器(和連結器)的正確旗標以便將 Python 直譯器嵌入你的應用程式"
627- "中,並不一定是簡單的事,特別是因為 Python 需要載入作為 C 動態擴充實作的函式庫 "
628- "模組(:file:`.so` 檔案)並連結到它 。"
627+ "中,並不一定是簡單的事,特別是因為 Python 需要載入作為 C 動態擴充(:file:`.so` 檔案)實作的函式庫 "
628+ "模組,而這些模組又必須與 Python 進行連結 。"
629629
630630#: ../../extending/embedding.rst:311
631631msgid ""
@@ -637,7 +637,7 @@ msgid ""
637637msgstr ""
638638"要找出所需的編譯器和連結器旗標,你可以執行作為安裝過程的一部分產生的 :file:"
639639"`python{X.Y}-config` 腳本(也可能有 :file:`python3-config` 腳本可用)。此腳本"
640- "有幾個選項,其中以下對你直接有用 :"
640+ "提供多種選項,其中以下幾個最為實用 :"
641641
642642#: ../../extending/embedding.rst:317
643643msgid ""
@@ -678,8 +678,8 @@ msgid ""
678678"that you use the absolute path to :file:`python{X.Y}-config`, as in the "
679679"above example."
680680msgstr ""
681- "為了避免多個 Python 安裝之間的混淆(特別是系統 Python 和你自己編譯的 Python "
682- "之間),建議你使用 :file:`python{X.Y}-config` 的絕對路徑,如上面的例子所示。"
681+ "為了避免多個 Python 安裝之間產生混淆(特別是系統自帶的 Python 與自行編譯的 Python "
682+ "之間),建議使用 :file:`python{X.Y}-config` 的絕對路徑,如上面的例子所示。"
683683
684684#: ../../extending/embedding.rst:339
685685msgid ""
@@ -692,11 +692,11 @@ msgid ""
692692"extract the configuration values that you will want to combine together. "
693693"For example:"
694694msgstr ""
695- "如果此程序對你不起作用(不保證對所有類 Unix 平台都有效;但是,我們歡迎 :ref:"
696- "`錯誤回報 <reporting-bugs>`),你將必須閱讀系統關於動態連結的文件和/ 或檢查 "
697- "Python 的 :file:`Makefile`(使用 :func:`sysconfig.get_makefile_filename` 來"
698- "找到其位置)和編譯選項。在這種情況下,:mod:`sysconfig` 模組是一個有用的工具 ,"
699- "可以程式化地擷取你想要組合在一起的組態值 。例如:"
695+ "如果此程序對你不起作用(並不保證在所有類 Unix 平台上都能運作;不過我們歡迎 \\ :ref:"
696+ "`錯誤回報 <reporting-bugs>`),你將需要參閱系統的動態連結相關文件,並/ 或檢查 "
697+ "Python 的 :file:`Makefile`\\ (可使用 :func:`sysconfig.get_makefile_filename` 來"
698+ "找到其位置)和編譯選項。在這種情況下,:mod:`sysconfig` 模組是一個實用的工具 ,"
699+ "可用於以程式化方式擷取並組合所需的組態值 。例如:"
700700
701701#: ../../extending/embedding.rst:348
702702msgid ""
0 commit comments