@@ -857,14 +857,13 @@ msgid ""
857857msgstr ""
858858
859859#: ../../extending/extending.rst:428
860- #, fuzzy
861860msgid ""
862861"When embedding Python, the :c:func:`!PyInit_spam` function is not called "
863862"automatically unless there's an entry in the :c:data:`!PyImport_Inittab` "
864863"table. To add the module to the initialization table, use :c:func:"
865864"`PyImport_AppendInittab`, optionally followed by an import of the module::"
866865msgstr ""
867- "嵌入 Python 時,除非在 :c:data:`PyImport_Inittab` 表中有相關條目,否則不會自"
866+ "嵌入 Python 時,除非在 :c:data:`! PyImport_Inittab` 表中有相關條目,否則不會自"
868867"動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使用 :c:func:"
869868"`PyImport_AppendInittab` 並在隨後選擇性地將該模組引入: ::"
870869
@@ -1523,7 +1522,7 @@ msgstr ""
15231522
15241523#: ../../extending/extending.rst:899
15251524msgid "Reference Counts"
1526- msgstr ""
1525+ msgstr "參照計數 "
15271526
15281527#: ../../extending/extending.rst:901
15291528msgid ""
@@ -1617,7 +1616,7 @@ msgstr ""
16171616
16181617#: ../../extending/extending.rst:971
16191618msgid "Reference Counting in Python"
1620- msgstr ""
1619+ msgstr "Python 中的參照計數 "
16211620
16221621#: ../../extending/extending.rst:973
16231622msgid ""
@@ -2304,129 +2303,3 @@ msgstr "PyArg_ParseTupleAndKeywords(C 函式)"
23042303#: ../../extending/extending.rst:797
23052304msgid "Philbrick, Geoff"
23062305msgstr "Philbrick, Geoff"
2307-
2308- #~ msgid ""
2309- #~ "All user-visible symbols defined by :file:`Python.h` have a prefix of "
2310- #~ "``Py`` or ``PY``, except those defined in standard header files. For "
2311- #~ "convenience, and since they are used extensively by the Python "
2312- #~ "interpreter, ``\"Python.h\"`` includes a few standard header files: "
2313- #~ "``<stdio.h>``, ``<string.h>``, ``<errno.h>``, and ``<stdlib.h>``. If the "
2314- #~ "latter header file does not exist on your system, it declares the "
2315- #~ "functions :c:func:`malloc`, :c:func:`free` and :c:func:`realloc` directly."
2316- #~ msgstr ""
2317- #~ "除了那些在標準標頭檔中定義的符號以外,所有由 :file:`Python.h` 定義的使用者"
2318- #~ "可見符號 (user-visible symbols) 的前綴都是 ``Py`` 或 ``PY``。為了方便,也"
2319- #~ "因為 Python 直譯器的大量使用,``\"Python.h\"`` 也引入了一些標準的標頭檔:"
2320- #~ "``<stdio.h>``、``<string.h>``、``<errno.h>`` 和 ``<stdlib.h>``。如果 "
2321- #~ "``<stdlib.h>`` 在你的系統上不存在,它會直接宣告 :c:func:`malloc`、:c:func:"
2322- #~ "`free` 和 :c:func:`realloc` 函式。"
2323-
2324- #~ msgid ""
2325- #~ "and initialize it in your module's initialization function (:c:func:`!"
2326- #~ "PyInit_spam`) with an exception object::"
2327- #~ msgstr ""
2328- #~ "並在你的模組初始化函式中使用一個例外物件來初始化它 (:c:func:`!"
2329- #~ "PyInit_spam`): ::"
2330-
2331- #~ msgid ""
2332- #~ "PyMODINIT_FUNC\n"
2333- #~ "PyInit_spam(void)\n"
2334- #~ "{\n"
2335- #~ " PyObject *m;\n"
2336- #~ "\n"
2337- #~ " m = PyModule_Create(&spammodule);\n"
2338- #~ " if (m == NULL)\n"
2339- #~ " return NULL;\n"
2340- #~ "\n"
2341- #~ " SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);\n"
2342- #~ " if (PyModule_AddObjectRef(m, \"error\", SpamError) < 0) {\n"
2343- #~ " Py_CLEAR(SpamError);\n"
2344- #~ " Py_DECREF(m);\n"
2345- #~ " return NULL;\n"
2346- #~ " }\n"
2347- #~ "\n"
2348- #~ " return m;\n"
2349- #~ "}"
2350- #~ msgstr ""
2351- #~ "PyMODINIT_FUNC\n"
2352- #~ "PyInit_spam(void)\n"
2353- #~ "{\n"
2354- #~ " PyObject *m;\n"
2355- #~ "\n"
2356- #~ " m = PyModule_Create(&spammodule);\n"
2357- #~ " if (m == NULL)\n"
2358- #~ " return NULL;\n"
2359- #~ "\n"
2360- #~ " SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);\n"
2361- #~ " if (PyModule_AddObjectRef(m, \"error\", SpamError) < 0) {\n"
2362- #~ " Py_CLEAR(SpamError);\n"
2363- #~ " Py_DECREF(m);\n"
2364- #~ " return NULL;\n"
2365- #~ " }\n"
2366- #~ "\n"
2367- #~ " return m;\n"
2368- #~ "}"
2369-
2370- #~ msgid ""
2371- #~ "static struct PyModuleDef spammodule = {\n"
2372- #~ " PyModuleDef_HEAD_INIT,\n"
2373- #~ " \"spam\", /* name of module */\n"
2374- #~ " spam_doc, /* module documentation, may be NULL */\n"
2375- #~ " -1, /* size of per-interpreter state of the module,\n"
2376- #~ " or -1 if the module keeps state in global variables. */\n"
2377- #~ " SpamMethods\n"
2378- #~ "};"
2379- #~ msgstr ""
2380- #~ "static struct PyModuleDef spammodule = {\n"
2381- #~ " PyModuleDef_HEAD_INIT,\n"
2382- #~ " \"spam\", /* 模組名稱 */\n"
2383- #~ " spam_doc, /* 模組文件,可能為 NULL */\n"
2384- #~ " -1, /* 模組的個別直譯器狀態的大小,\n"
2385- #~ " 如果模組將狀態保存在全域變數中則為 -1 */\n"
2386- #~ " SpamMethods\n"
2387- #~ "};"
2388-
2389- #~ msgid ""
2390- #~ "When the Python program imports module :mod:`!spam` for the first time, :"
2391- #~ "c:func:`!PyInit_spam` is called. (See below for comments about embedding "
2392- #~ "Python.) It calls :c:func:`PyModule_Create`, which returns a module "
2393- #~ "object, and inserts built-in function objects into the newly created "
2394- #~ "module based upon the table (an array of :c:type:`PyMethodDef` "
2395- #~ "structures) found in the module definition. :c:func:`PyModule_Create` "
2396- #~ "returns a pointer to the module object that it creates. It may abort "
2397- #~ "with a fatal error for certain errors, or return ``NULL`` if the module "
2398- #~ "could not be initialized satisfactorily. The init function must return "
2399- #~ "the module object to its caller, so that it then gets inserted into ``sys."
2400- #~ "modules``."
2401- #~ msgstr ""
2402- #~ "當 Python 程式第一次引入模組 :mod:`!spam` 時,:c:func:`!PyInit_spam` 會被"
2403- #~ "呼叫。(有關嵌入 Python 的註解請參見下文。)它會呼叫回傳一個模組物件的 :c:"
2404- #~ "func:`PyModule_Create`,並根據在模組定義中所找到的表(一個 :c:type:"
2405- #~ "`PyMethodDef` 結構的陣列)將內建的函式物件插入到新建立的模組中。:c:func:"
2406- #~ "`PyModule_Create` 會回傳一個指向它建立之模組物件的指標。對於某些錯誤情況,"
2407- #~ "它可能會以嚴重錯誤的形式來中止;如果模組無法令人滿意地被初始化,它也會回"
2408- #~ "傳 ``NULL``。初始化函式必須把模組物件回傳給它的呼叫者,這樣它才會被插入到 "
2409- #~ "``sys.modules`` 中。"
2410-
2411- #~ msgid ""
2412- #~ "Removing entries from ``sys.modules`` or importing compiled modules into "
2413- #~ "multiple interpreters within a process (or following a :c:func:`fork` "
2414- #~ "without an intervening :c:func:`exec`) can create problems for some "
2415- #~ "extension modules. Extension module authors should exercise caution when "
2416- #~ "initializing internal data structures."
2417- #~ msgstr ""
2418- #~ "從 ``sys.modules`` 中移除項目,或在一個行程中將已編譯模組引入到多個直譯器"
2419- #~ "中(或在沒有 :c:func:`exec` 介入的情況下使用 :c:func:`fork`)可能會對某些"
2420- #~ "擴充模組造成問題。擴充模組作者在初始化內部資料結構時應特別小心。"
2421-
2422- #~ msgid ""
2423- #~ "Unlike our ``spam`` example, ``xxmodule`` uses *multi-phase "
2424- #~ "initialization* (new in Python 3.5), where a PyModuleDef structure is "
2425- #~ "returned from ``PyInit_spam``, and creation of the module is left to the "
2426- #~ "import machinery. For details on multi-phase initialization, see :PEP:"
2427- #~ "`489`."
2428- #~ msgstr ""
2429- #~ "不像我們的 ``spam`` 範例,``xxmodule`` 使用了\\ *多階段初始化 (multi-"
2430- #~ "phase initialization)*\\ (Python 3.5 新增),其中的 PyModuleDef 結構會從 "
2431- #~ "``PyInit_spam`` 回傳,而模組的建立則交由引入機制來完成。關於多階段初始化的"
2432- #~ "詳細資訊請參閱 :PEP:`489`。"