55#
66# Translators:
77# python-doc bot, 2025
8+ # Inada Naoki <songofacandy@gmail.com>, 2026
89#
910#, fuzzy
1011msgid ""
1112msgstr ""
1213"Project-Id-Version : Python 3.15\n "
1314"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2026-10-01 19:07 +0000\n "
15+ "POT-Creation-Date : 2026-10-25 17:19 +0000\n "
1516"PO-Revision-Date : 2025-09-16 00:00+0000\n "
16- "Last-Translator : python-doc bot, 2025 \n "
17+ "Last-Translator : Inada Naoki <songofacandy@gmail.com>, 2026 \n "
1718"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
1819"ja/)\n "
1920"MIME-Version : 1.0\n "
@@ -51,29 +52,32 @@ msgstr "ほとんどの中級から上級の Python 本もこの話題を扱っ
5152msgid "Can I create my own functions in C++?"
5253msgstr "C++ で独自の関数を作ることはできますか?"
5354
54- #: ../../faq/extending.rst:28
5555msgid ""
5656"Yes, using the C compatibility features found in C++. Place ``extern "
5757"\" C\" { ... }`` around the Python include files and put ``extern \" C\" `` "
5858"before each function that is going to be called by the Python interpreter. "
5959"Global or static C++ objects with constructors are probably not a good idea."
6060msgstr ""
61- "はい。C++ 内にある C 互換機能を使ってできます。 ``extern \" C\" { ... }`` で "
62- "Python のインクルードファイルを囲み、 ``extern \" C\" `` を Python インタプリタ"
63- "から呼ぶ各関数の前に置いてください。グローバルや静的な C++ オブジェクトの構造"
64- "体を持つものは良くないでしょう。"
61+ "はい。\n"
62+ "C++ 内にある C 互換機能を使ってできます。\n"
63+ "``extern \" C\" { ... }`` で Python のインクルードファイルを囲み、 ``extern "
64+ "\" C\" `` を Python インタプリタから呼ぶ各関数の前に置いてください。\n"
65+ "コンストラクタを持つグローバルな C++ オブジェクトや静的な C++ オブジェクトを"
66+ "使うのは、おそらく望ましくありません。"
6567
6668#: ../../faq/extending.rst:37
6769msgid "Writing C is hard; are there any alternatives?"
6870msgstr "C を書くのは大変です。他の方法はありませんか?"
6971
70- #: ../../faq/extending.rst:39
7172msgid ""
7273"There are a number of alternatives to writing your own C extensions, "
7374"depending on what you're trying to do. :ref:`Recommended third party tools "
7475"<c-api-tools>` offer both simpler and more sophisticated approaches to "
7576"creating C and C++ extensions for Python."
7677msgstr ""
78+ "何をしたいかに応じて、C 拡張を自分で書く以外にもいくつかの方法があります。\n"
79+ ":ref:`推奨されるサードパーティツール <c-api-tools>` には、Python の C/C++ 拡"
80+ "張をより簡単に作るものや、より高度な方法を提供するものがあります。"
7781
7882#: ../../faq/extending.rst:46
7983msgid "How can I execute arbitrary Python statements from C?"
@@ -185,22 +189,23 @@ msgstr ""
185189"す。パラメタは、オブジェクト、呼び出すメソッドの名前、 :c:func:"
186190"`Py_BuildValue` で使われるようなフォーマット文字列、そして引数です::"
187191
188- #: ../../faq/extending.rst:102
189192msgid ""
190193"PyObject *\n"
191194"PyObject_CallMethod(PyObject *object, const char *method_name,\n"
192195" const char *arg_format, ...);"
193196msgstr ""
197+ "PyObject *\n"
198+ "PyObject_CallMethod(PyObject *object, const char *method_name,\n"
199+ " const char *arg_format, ...);"
194200
195- #: ../../faq/extending.rst:106
196201msgid ""
197202"This works for any object that has methods -- whether built-in or user-"
198203"defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the "
199204"return value."
200205msgstr ""
201- "これはメソッドを持ついかなるオブジェクトにも有効で、組み込みかユーザ定義かは "
202- "関係ありません。返り値に対して :c:func:`Py_DECREF` する必要があることもありま "
203- "す 。"
206+ "これは、組み込みかユーザー定義かを問わず、メソッドを持つ任意のオブジェクトに "
207+ "使えます。\n "
208+ "返り値を使い終わったら、呼び出し側で :c:func:`Py_DECREF` する責任があります 。"
204209
205210#: ../../faq/extending.rst:109
206211msgid ""
@@ -210,7 +215,6 @@ msgstr ""
210215"例えば、あるファイルオブジェクトの \" seek\" メソッドを 10, 0 を引数として呼ぶ"
211216"とき (ファイルオブジェクトのポインタを \" f\" とします)::"
212217
213- #: ../../faq/extending.rst:112
214218msgid ""
215219"res = PyObject_CallMethod(f, \" seek\" , \" (ii)\" , 10, 0);\n"
216220"if (res == NULL) {\n"
@@ -220,17 +224,24 @@ msgid ""
220224" Py_DECREF(res);\n"
221225"}"
222226msgstr ""
227+ "res = PyObject_CallMethod(f, \" seek\" , \" (ii)\" , 10, 0);\n"
228+ "if (res == NULL) {\n"
229+ " ... 例外が発生した場合の処理 ...\n"
230+ "}\n"
231+ "else {\n"
232+ " Py_DECREF(res);\n"
233+ "}"
223234
224- #: ../../faq/extending.rst:120
225235msgid ""
226236"Note that since :c:func:`PyObject_CallObject` *always* wants a tuple for the "
227237"argument list, to call a function without arguments, pass \" ()\" for the "
228238"format, and to call a function with one argument, surround the argument in "
229239"parentheses, e.g. \" (i)\" ."
230240msgstr ""
231241"なお、 :c:func:`PyObject_CallObject` の引数リストには *常に* タプルが必要で"
232- "す。関数を引数なしで呼び出すには、フォーマットに \" ()\" を渡し、関数を一つの"
233- "引数で呼び出すには、関数を括弧でくくって例えば \" (i)\" としてください。"
242+ "す。\n"
243+ "関数を引数なしで呼び出すには、フォーマットに \" ()\" を渡し、関数を一つの引数"
244+ "で呼び出すには、引数の書式を括弧で囲んで例えば \" (i)\" としてください。"
234245
235246#: ../../faq/extending.rst:127
236247msgid ""
@@ -256,7 +267,6 @@ msgstr ""
256267msgid "The easiest way to do this is to use the :class:`io.StringIO` class:"
257268msgstr "最も簡単な方法は、 :class:`io.StringIO` クラスを使うことです:"
258269
259- #: ../../faq/extending.rst:136
260270msgid ""
261271">>> import io, sys\n"
262272">>> sys.stdout = io.StringIO()\n"
@@ -266,12 +276,18 @@ msgid ""
266276"foo\n"
267277"hello world!"
268278msgstr ""
279+ ">>> import io, sys\n"
280+ ">>> sys.stdout = io.StringIO()\n"
281+ ">>> print('foo')\n"
282+ ">>> print('hello world!')\n"
283+ ">>> sys.stderr.write(sys.stdout.getvalue())\n"
284+ "foo\n"
285+ "hello world!"
269286
270287#: ../../faq/extending.rst:146
271288msgid "A custom object to do the same would look like this:"
272289msgstr "これと同じことをするカスタムオブジェクトは次のようになるでしょう:"
273290
274- #: ../../faq/extending.rst:148
275291msgid ""
276292">>> import io, sys\n"
277293">>> class StdoutCatcher(io.TextIOBase):\n"
@@ -288,6 +304,20 @@ msgid ""
288304"foo\n"
289305"hello world!"
290306msgstr ""
307+ ">>> import io, sys\n"
308+ ">>> class StdoutCatcher(io.TextIOBase):\n"
309+ "... def __init__(self):\n"
310+ "... self.data = []\n"
311+ "... def write(self, stuff):\n"
312+ "... self.data.append(stuff)\n"
313+ "...\n"
314+ ">>> import sys\n"
315+ ">>> sys.stdout = StdoutCatcher()\n"
316+ ">>> print('foo')\n"
317+ ">>> print('hello world!')\n"
318+ ">>> sys.stderr.write(''.join(sys.stdout.data))\n"
319+ "foo\n"
320+ "hello world!"
291321
292322#: ../../faq/extending.rst:167
293323msgid "How do I access a module written in Python from C?"
@@ -297,9 +327,8 @@ msgstr "C から Python で書かれたモジュールにアクセスするに
297327msgid "You can get a pointer to the module object as follows::"
298328msgstr "以下のようにモジュールオブジェクトへのポインタを得られます::"
299329
300- #: ../../faq/extending.rst:171
301330msgid "module = PyImport_ImportModule(\" <modulename>\" );"
302- msgstr ""
331+ msgstr "module = PyImport_ImportModule( \" <modulename> \" ); "
303332
304333#: ../../faq/extending.rst:173
305334msgid ""
@@ -323,9 +352,8 @@ msgstr ""
323352"これで、モジュールの属性 (つまり、モジュールで定義された任意の名前) に以下の"
324353"ようにアクセスできるようになります::"
325354
326- #: ../../faq/extending.rst:182
327355msgid "attr = PyObject_GetAttrString(module, \" <attrname>\" );"
328- msgstr ""
356+ msgstr "attr = PyObject_GetAttrString(module, \" <attrname> \" ); "
329357
330358#: ../../faq/extending.rst:184
331359msgid ""
@@ -379,13 +407,12 @@ msgstr ""
379407msgid "How do I debug an extension?"
380408msgstr "拡張をデバッグするにはどうしますか?"
381409
382- #: ../../faq/extending.rst:211
383410msgid ""
384411"When using GDB with dynamically loaded extensions, you can't set a "
385412"breakpoint in your extension until your extension is loaded."
386413msgstr ""
387414"動的にロードされた拡張に GDB を使うとき、拡張がロードされるまでブレークポイン"
388- "トを設定してはいけません 。"
415+ "トを設定できません 。"
389416
390417#: ../../faq/extending.rst:214
391418msgid "In your ``.gdbinit`` file (or interactively), add the command:"
@@ -417,19 +444,20 @@ msgstr ""
417444"Linux システムで Python モジュールをコンパイルしたいのですが、見つからない"
418445"ファイルがあります。なぜですか?"
419446
420- #: ../../faq/extending.rst:234
421447msgid ""
422448"Most packaged versions of Python omit some files required for compiling "
423449"Python extensions."
424450msgstr ""
451+ "パッケージとして配布されている Python の多くでは、Python 拡張のコンパイルに必"
452+ "要なファイルの一部が省かれています。"
425453
426- #: ../../faq/extending.rst:237
427454msgid "For Red Hat, install the python3-devel RPM to get the necessary files."
428455msgstr ""
456+ "Red Hat では、必要なファイルを入手するために python3-devel RPM をインストール"
457+ "してください。"
429458
430- #: ../../faq/extending.rst:239
431459msgid "For Debian, run ``apt-get install python3-dev``."
432- msgstr ""
460+ msgstr "Debian では ``apt-get install python3-dev`` を実行してください。 "
433461
434462#: ../../faq/extending.rst:242
435463msgid "How do I tell \" incomplete input\" from \" invalid input\" ?"
0 commit comments