-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathextending.po
518 lines (458 loc) · 25.7 KB
/
extending.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2021, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Hiroyuki Kurosawa <[email protected]>, 2019
# tomo, 2019
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-01 16:02+0000\n"
"PO-Revision-Date: 2019-09-01 02:43+0000\n"
"Last-Translator: tomo, 2019\n"
"Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/"
"ja/)\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../faq/extending.rst:3
msgid "Extending/Embedding FAQ"
msgstr "拡張と埋め込み FAQ"
#: ../../faq/extending.rst:6
msgid "Contents"
msgstr "内容"
#: ../../faq/extending.rst:16
msgid "Can I create my own functions in C?"
msgstr "C で独自の関数を作ることはできますか?"
#: ../../faq/extending.rst:18
msgid ""
"Yes, you can create built-in modules containing functions, variables, "
"exceptions and even new types in C. This is explained in the document :ref:"
"`extending-index`."
msgstr ""
"はい。関数、変数、例外、そして新しいタイプまで含んだビルトインモジュールを C "
"で作れます。これはドキュメント :ref:`extending-index` で説明されています。"
#: ../../faq/extending.rst:22
msgid "Most intermediate or advanced Python books will also cover this topic."
msgstr "ほとんどの中級から上級の Python 本もこの話題を扱っています。"
#: ../../faq/extending.rst:26
msgid "Can I create my own functions in C++?"
msgstr "C++ で独自の関数を作ることはできますか?"
#: ../../faq/extending.rst:28
msgid ""
"Yes, using the C compatibility features found in C++. Place ``extern "
"\"C\" { ... }`` around the Python include files and put ``extern \"C\"`` "
"before each function that is going to be called by the Python interpreter. "
"Global or static C++ objects with constructors are probably not a good idea."
msgstr ""
"はい。C++ 内にある C 互換機能を使ってできます。 ``extern \"C\" { ... }`` で "
"Python のインクルードファイルを囲み、 ``extern \"C\"`` を Python インタプリタ"
"から呼ぶ各関数の前に置いてください。グローバルや静的な C++ オブジェクトの構造"
"体を持つものは良くないでしょう。"
#: ../../faq/extending.rst:37
msgid "Writing C is hard; are there any alternatives?"
msgstr "C を書くのは大変です。他の方法はありませんか?"
#: ../../faq/extending.rst:39
msgid ""
"There are a number of alternatives to writing your own C extensions, "
"depending on what you're trying to do."
msgstr "独自の C 拡張を書くための別のやり方は、目的によっていくつかあります。"
#: ../../faq/extending.rst:44
msgid ""
"`Cython <http://cython.org>`_ and its relative `Pyrex <https://www.cosc."
"canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ are compilers that accept a "
"slightly modified form of Python and generate the corresponding C code. "
"Cython and Pyrex make it possible to write an extension without having to "
"learn Python's C API."
msgstr ""
"`Cython <http://cython.org>`_ とその親戚 `Pyrex <https://www.cosc.canterbury."
"ac.nz/greg.ewing/python/Pyrex/>`_ は、わずかに変形した Python を受け取り、対"
"応する C コードを生成します。Cython や Pyrex を使えば Python の C API を習得"
"することなく拡張を書けます。"
#: ../../faq/extending.rst:50
msgid ""
"If you need to interface to some C or C++ library for which no Python "
"extension currently exists, you can try wrapping the library's data types "
"and functions with a tool such as `SWIG <http://www.swig.org>`_. `SIP "
"<https://riverbankcomputing.com/software/sip/intro>`__, `CXX <http://cxx."
"sourceforge.net/>`_ `Boost <http://www.boost.org/libs/python/doc/index."
"html>`_, or `Weave <https://github.com/scipy/weave>`_ are also alternatives "
"for wrapping C++ libraries."
msgstr ""
"今のところ Python 拡張が存在しないような C や C++ ライブラリへのインターフェ"
"イスが必要な場合、`SWIG <http://www.swig.org>`_ のようなツールで、そのライブ"
"ラリのデータ型のラッピングを図れます。\n"
"`SIP <https://riverbankcomputing.com/software/sip/intro>`_、`CXX <http://cxx."
"sourceforge.net/>`_、`Boost <http://www.boost.org/libs/python/doc/index."
"html>`_、`Weave <https://github.com/scipy/weave>`_ でも C++ ライブラリをラッ"
"ピングできます。"
#: ../../faq/extending.rst:61
msgid "How can I execute arbitrary Python statements from C?"
msgstr "C から任意の Python 文を実行するにはどうしますか?"
#: ../../faq/extending.rst:63
msgid ""
"The highest-level function to do this is :c:func:`PyRun_SimpleString` which "
"takes a single string argument to be executed in the context of the module "
"``__main__`` and returns ``0`` for success and ``-1`` when an exception "
"occurred (including :exc:`SyntaxError`). If you want more control, use :c:"
"func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in "
"``Python/pythonrun.c``."
msgstr ""
"これを行う最高水準の関数は :c:func:`PyRun_SimpleString` で、一つの文字列引数"
"を取り、モジュール ``__main__`` のコンテキストでそれを実行し、成功なら "
"``0``、例外 (:exc:`SyntaxError` を含む) が発生したら ``-1`` を返します。更に"
"制御したければ、 :c:func:`PyRun_String` を使ってください。ソースは ``Python/"
"pythonrun.c`` の ':c:func:`PyRun_SimpleString` を参照してください。"
#: ../../faq/extending.rst:72
msgid "How can I evaluate an arbitrary Python expression from C?"
msgstr "C から任意の Python 式を評価するにはどうしますか?"
#: ../../faq/extending.rst:74
msgid ""
"Call the function :c:func:`PyRun_String` from the previous question with the "
"start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it "
"and returns its value."
msgstr ""
"先の質問の :c:func:`PyRun_String` を、スタートシンボル :c:data:"
"`Py_eval_input` を渡して呼び出してください。これは式を解析し、評価してその値"
"を返します。"
#: ../../faq/extending.rst:80
msgid "How do I extract C values from a Python object?"
msgstr "Python オブジェクトから C の値を取り出すにはどうしますか?"
#: ../../faq/extending.rst:82
msgid ""
"That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` "
"returns its length and :c:func:`PyTuple_GetItem` returns the item at a "
"specified index. Lists have similar functions, :c:func:`PyListSize` and :c:"
"func:`PyList_GetItem`."
msgstr ""
"オブジェクトの型に依ります。タプルなら、 :c:func:`PyTuple_Size` が長さを返"
"し、 :c:func:`PyTuple_GetItem` が指定されたインデックスの要素を返します。リス"
"トにも同様の関数 :c:func:`PyList_Size` と :c:func:`PyList_GetItem` がありま"
"す。"
#: ../../faq/extending.rst:87
msgid ""
"For bytes, :c:func:`PyBytes_Size` returns its length and :c:func:"
"`PyBytes_AsStringAndSize` provides a pointer to its value and its length. "
"Note that Python bytes objects may contain null bytes so C's :c:func:"
"`strlen` should not be used."
msgstr ""
"bytes では、 :c:func:`PyBytes_Size` がその長さを返し、 :c:func:"
"`PyBytes_AsStringAndSize` がその値へのポインタと長さを提供します。 Python の "
"bytes オブジェクトは null を含むこともできるので、 C の :c:func:`strlen` を使"
"うべきではないことに注意してください。"
#: ../../faq/extending.rst:92
msgid ""
"To test the type of an object, first make sure it isn't ``NULL``, and then "
"use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:"
"`PyList_Check`, etc."
msgstr ""
"オブジェクトの型を検査するには、まず最初にそれが ``NULL`` でないことを確かめ"
"た上で、 :c:func:`PyBytes_Check` 、 :c:func:`PyTuple_Check` 、 :c:func:"
"`PyList_Check` などを使います。"
#: ../../faq/extending.rst:95
msgid ""
"There is also a high-level API to Python objects which is provided by the so-"
"called 'abstract' interface -- read ``Include/abstract.h`` for further "
"details. It allows interfacing with any kind of Python sequence using calls "
"like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc. as well "
"as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et "
"al.) and mappings in the PyMapping APIs."
msgstr ""
"いわゆる 'abstract' インターフェースから提供される、 Python オブジェクトに対"
"する高レベル API もあります -- より詳しいことは ``Include/abstract.h`` を読ん"
"でください。これを使うと、数値型プロトコル (:c:func:`PyNumber_Index` など) "
"や PyMapping API のマップ型プロトコルなどの役に立つプロトコルに加え、 :c:"
"func:`PySequence_Length` や :c:func:`PySequence_GetItem` などの任意の種類の "
"Python シーケンスへのインターフェースにアクセスできます。"
#: ../../faq/extending.rst:104
msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?"
msgstr "Py_BuildValue() で任意長のタプルを作るにはどうしますか?"
#: ../../faq/extending.rst:106
msgid "You can't. Use :c:func:`PyTuple_Pack` instead."
msgstr "できません。代わりに :c:func:`PyTuple_Pack` を使ってください。"
#: ../../faq/extending.rst:110
msgid "How do I call an object's method from C?"
msgstr "C からオブジェクトのメソッドを呼び出すにはどうしますか?"
#: ../../faq/extending.rst:112
msgid ""
"The :c:func:`PyObject_CallMethod` function can be used to call an arbitrary "
"method of an object. The parameters are the object, the name of the method "
"to call, a format string like that used with :c:func:`Py_BuildValue`, and "
"the argument values::"
msgstr ""
":c:func:`PyObject_CallMethod` 関数でオブジェクトの任意のメソッドを呼び出せま"
"す。パラメタは、オブジェクト、呼び出すメソッドの名前、 :c:func:"
"`Py_BuildValue` で使われるようなフォーマット文字列、そして引数です::"
#: ../../faq/extending.rst:121
msgid ""
"This works for any object that has methods -- whether built-in or user-"
"defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the "
"return value."
msgstr ""
"これはメソッドを持ついかなるオブジェクトにも有効で、組み込みかユーザ定義かは"
"関係ありません。返り値に対して :c:func:`Py_DECREF` する必要があることもありま"
"す。"
#: ../../faq/extending.rst:124
msgid ""
"To call, e.g., a file object's \"seek\" method with arguments 10, 0 "
"(assuming the file object pointer is \"f\")::"
msgstr ""
"例えば、あるファイルオブジェクトの \"seek\" メソッドを 10, 0 を引数として呼ぶ"
"とき (ファイルオブジェクトのポインタを \"f\" とします)::"
#: ../../faq/extending.rst:135
msgid ""
"Note that since :c:func:`PyObject_CallObject` *always* wants a tuple for the "
"argument list, to call a function without arguments, pass \"()\" for the "
"format, and to call a function with one argument, surround the argument in "
"parentheses, e.g. \"(i)\"."
msgstr ""
"なお、 :c:func:`PyObject_CallObject` の引数リストには *常に* タプルが必要で"
"す。関数を引数なしで呼び出すには、フォーマットに \"()\" を渡し、関数を一つの"
"引数で呼び出すには、関数を括弧でくくって例えば \"(i)\" としてください。"
#: ../../faq/extending.rst:142
msgid ""
"How do I catch the output from PyErr_Print() (or anything that prints to "
"stdout/stderr)?"
msgstr ""
"PyErr_Print() (その他 stdout/stderr に印字するもの) からの出力を受け取るには"
"どうしますか?"
#: ../../faq/extending.rst:144
msgid ""
"In Python code, define an object that supports the ``write()`` method. "
"Assign this object to :data:`sys.stdout` and :data:`sys.stderr`. Call "
"print_error, or just allow the standard traceback mechanism to work. Then, "
"the output will go wherever your ``write()`` method sends it."
msgstr ""
"Python コード内で、 ``write()`` メソッドをサポートするオブジェクトを定義して"
"ください。そのオブジェクトを :data:`sys.stdout` と :data:`sys.stderr` に代入"
"してください。print_error を呼び出すか、単に標準のトレースバック機構を作動さ"
"せてください。そうすれば、出力は ``write()`` が送る任意の所に行きます。"
#: ../../faq/extending.rst:149
msgid "The easiest way to do this is to use the :class:`io.StringIO` class:"
msgstr "最も簡単な方法は、 :class:`io.StringIO` クラスを使うことです:"
#: ../../faq/extending.rst:161
msgid "A custom object to do the same would look like this:"
msgstr "これと同じことをするカスタムオブジェクトは次のようになるでしょう:"
#: ../../faq/extending.rst:182
msgid "How do I access a module written in Python from C?"
msgstr "C から Python で書かれたモジュールにアクセスするにはどうしますか?"
#: ../../faq/extending.rst:184
msgid "You can get a pointer to the module object as follows::"
msgstr "以下のようにモジュールオブジェクトへのポインタを得られます::"
#: ../../faq/extending.rst:188
msgid ""
"If the module hasn't been imported yet (i.e. it is not yet present in :data:"
"`sys.modules`), this initializes the module; otherwise it simply returns the "
"value of ``sys.modules[\"<modulename>\"]``. Note that it doesn't enter the "
"module into any namespace -- it only ensures it has been initialized and is "
"stored in :data:`sys.modules`."
msgstr ""
"そのモジュールがまだインポートされていない (つまり、まだ :data:`sys.modules` "
"に現れていない) なら、これはモジュールを初期化します。そうでなければ、単純に "
"``sys.modules[\"<modulename>\"]`` の値を返します。なお、これはモジュールをい"
"かなる名前空間にも代入しません。これはモジュールが初期化されて ':data:`sys."
"modules` に保管されていることを保証するだけです。"
#: ../../faq/extending.rst:194
msgid ""
"You can then access the module's attributes (i.e. any name defined in the "
"module) as follows::"
msgstr ""
"これで、モジュールの属性 (つまり、モジュールで定義された任意の名前) に以下の"
"ようにアクセスできるようになります::"
#: ../../faq/extending.rst:199
msgid ""
"Calling :c:func:`PyObject_SetAttrString` to assign to variables in the "
"module also works."
msgstr ""
":c:func:`PyObject_SetAttrString` を呼んでモジュールの変数に代入することもでき"
"ます。"
#: ../../faq/extending.rst:204
msgid "How do I interface to C++ objects from Python?"
msgstr "Python から C++ へインタフェースするにはどうしますか?"
#: ../../faq/extending.rst:206
msgid ""
"Depending on your requirements, there are many approaches. To do this "
"manually, begin by reading :ref:`the \"Extending and Embedding\" document "
"<extending-index>`. Realize that for the Python run-time system, there "
"isn't a whole lot of difference between C and C++ -- so the strategy of "
"building a new Python type around a C structure (pointer) type will also "
"work for C++ objects."
msgstr ""
"やりたいことに応じて、いろいろな方法があります。手動でやるなら、 :ref:`\"拡張"
"と埋め込み\" ドキュメント <extending-index>` を読むことから始めてください。な"
"お、Python ランタイムシステムにとっては、 C と C++ はあまり変わりません。だか"
"ら、C 構造体 (ポインタ)型に基づいて新しい Python の型を構築する方針は C++ オ"
"ブジェクトに対しても有効です。"
#: ../../faq/extending.rst:212
msgid "For C++ libraries, see :ref:`c-wrapper-software`."
msgstr ""
"C++ ライブラリに関しては、 :ref:`c-wrapper-software` を参照してください。"
#: ../../faq/extending.rst:216
msgid "I added a module using the Setup file and the make fails; why?"
msgstr ""
"セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。な"
"ぜですか?"
#: ../../faq/extending.rst:218
msgid ""
"Setup must end in a newline, if there is no newline there, the build process "
"fails. (Fixing this requires some ugly shell script hackery, and this bug "
"is so minor that it doesn't seem worth the effort.)"
msgstr ""
"セットアップは改行で終わらなければならなくて、改行がないと、ビルド工程は失敗"
"します。(これを直すには、ある種の醜いシェルスクリプトハックが必要ですが、この"
"バグは小さいものですから努力に見合う価値はないでしょう。)"
#: ../../faq/extending.rst:224
msgid "How do I debug an extension?"
msgstr "拡張をデバッグするにはどうしますか?"
#: ../../faq/extending.rst:226
msgid ""
"When using GDB with dynamically loaded extensions, you can't set a "
"breakpoint in your extension until your extension is loaded."
msgstr ""
"動的にロードされた拡張に GDB を使うとき、拡張がロードされるまでブレークポイン"
"トを設定してはいけません。"
#: ../../faq/extending.rst:229
msgid "In your ``.gdbinit`` file (or interactively), add the command:"
msgstr "``.gdbinit`` ファイルに(または対話的に)、このコマンドを加えてください:"
#: ../../faq/extending.rst:235
msgid "Then, when you run GDB:"
msgstr "そして、GDB を起動するときに:"
#: ../../faq/extending.rst:247
msgid ""
"I want to compile a Python module on my Linux system, but some files are "
"missing. Why?"
msgstr ""
"Linux システムで Python モジュールをコンパイルしたいのですが、見つからない"
"ファイルがあります。なぜですか?"
#: ../../faq/extending.rst:249
msgid ""
"Most packaged versions of Python don't include the :file:`/usr/lib/python2."
"{x}/config/` directory, which contains various files required for compiling "
"Python extensions."
msgstr ""
"Python の多くのパッケージバージョンには、Python 拡張をコンパイルするのに必要"
"な様々なファイルを含む :file:`/usr/lib/python2.{x}/config/` ディレクトリが含"
"まれていません。"
#: ../../faq/extending.rst:253
msgid "For Red Hat, install the python-devel RPM to get the necessary files."
msgstr ""
"Red Hat では、Python RPM をインストールして必要なファイルを得てください。"
#: ../../faq/extending.rst:255
msgid "For Debian, run ``apt-get install python-dev``."
msgstr "Debian では、 ``apt-get install python-dev`` を実行してください。"
#: ../../faq/extending.rst:259
msgid "How do I tell \"incomplete input\" from \"invalid input\"?"
msgstr ""
"\"不完全 (incomplete) な入力\" を \"不適切 (invalid) な入力\" から区別するに"
"はどうしますか?"
#: ../../faq/extending.rst:261
msgid ""
"Sometimes you want to emulate the Python interactive interpreter's behavior, "
"where it gives you a continuation prompt when the input is incomplete (e.g. "
"you typed the start of an \"if\" statement or you didn't close your "
"parentheses or triple string quotes), but it gives you a syntax error "
"message immediately when the input is invalid."
msgstr ""
"Python インタラクティブインタプリタでは、入力が不完全なとき (例えば、 \"if\" "
"文の始まりをタイプした時や、カッコや三重文字列引用符を閉じていない時など) に"
"は継続プロンプトを与えられますが、入力が不適切であるときには即座に構文エラー"
"メッセージが与えられます。このようなふるまいを模倣したいことがあります。"
#: ../../faq/extending.rst:267
msgid ""
"In Python you can use the :mod:`codeop` module, which approximates the "
"parser's behavior sufficiently. IDLE uses this, for example."
msgstr ""
"Python では構文解析器のふるまいに十分に近い :mod:`codeop` モジュールが使えま"
"す。例えば IDLE がこれを使っています。"
#: ../../faq/extending.rst:270
msgid ""
"The easiest way to do it in C is to call :c:func:`PyRun_InteractiveLoop` "
"(perhaps in a separate thread) and let the Python interpreter handle the "
"input for you. You can also set the :c:func:`PyOS_ReadlineFunctionPointer` "
"to point at your custom input function. See ``Modules/readline.c`` and "
"``Parser/myreadline.c`` for more hints."
msgstr ""
"これを C で行う最も簡単な方法は、 :c:func:`PyRun_InteractiveLoop` を (必要な"
"らば別のスレッドで) 呼び出し、Python インタプリタにあなたの入力を扱わせること"
"です。独自の入力関数を指定するのに :c:func:`PyOS_ReadlineFunctionPointer` を"
"設定することもできます。詳しいヒントは、 ``Modules/readline.c`` や ``Parser/"
"myreadline.c`` を参照してください。"
#: ../../faq/extending.rst:276
msgid ""
"However sometimes you have to run the embedded Python interpreter in the "
"same thread as your rest application and you can't allow the :c:func:"
"`PyRun_InteractiveLoop` to stop while waiting for user input. The one "
"solution then is to call :c:func:`PyParser_ParseString` and test for ``e."
"error`` equal to ``E_EOF``, which means the input is incomplete. Here's a "
"sample code fragment, untested, inspired by code from Alex Farber::"
msgstr ""
"しかし、組み込みの Python インタープリタを他のアプリケーションと同じスレッド"
"で実行することが必要で、 :c:func:`PyRun_InteractiveLoop` でユーザの入力を待っ"
"ている間止められないこともあります。このような場合の解決策の一つは、 :c:func:"
"`PyParser_ParseString` を呼んで ``e.error`` と ``E_EOF`` が等しいこと、つまり"
"入力が不完全であることを確かめることです。これは、Alex Farber のコードを参考"
"にした、未テストのサンプルコード片です::"
#: ../../faq/extending.rst:310
msgid ""
"Another solution is trying to compile the received string with :c:func:"
"`Py_CompileString`. If it compiles without errors, try to execute the "
"returned code object by calling :c:func:`PyEval_EvalCode`. Otherwise save "
"the input for later. If the compilation fails, find out if it's an error or "
"just more input is required - by extracting the message string from the "
"exception tuple and comparing it to the string \"unexpected EOF while "
"parsing\". Here is a complete example using the GNU readline library (you "
"may want to ignore **SIGINT** while calling readline())::"
msgstr ""
"別の解決策は、受け取られた文字列を :c:func:`Py_CompileString` でコンパイルす"
"ることを試みることです。エラー無くコンパイルされたら、返されたコードオブジェ"
"クトを :c:func:`PyEval_EvalCode` を呼んで実行することを試みてください。そうで"
"なければ、入力を後のために保存してください。コンパイルが失敗したなら、それが"
"エラーなのか入力の続きが求められているだけなのか調べてください。そのために"
"は、例外タプルからメッセージ文字列を展開し、それを文字列 \"unexpected EOF "
"while parsing\" と比較します。ここに GNU readline library を使った完全な例が"
"あります (readline() を読んでいる間は **SIGINT** を無視したいかもしれませ"
"ん)::"
#: ../../faq/extending.rst:432
msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?"
msgstr ""
"未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしま"
"すか?"
#: ../../faq/extending.rst:434
msgid ""
"To dynamically load g++ extension modules, you must recompile Python, relink "
"it using g++ (change LINKCC in the Python Modules Makefile), and link your "
"extension module using g++ (e.g., ``g++ -shared -o mymodule.so mymodule.o``)."
msgstr ""
"g++ モジュールを動的にロードするには、Python を再コンパイルし、それを g++ で"
"再リンク (Python Modules Makefile 内の LINKCC を変更) し、拡張を g++ でリン"
"ク (例えば ``g++ -shared -o mymodule.so mymodule.o``) しなければなりません。"
#: ../../faq/extending.rst:440
msgid ""
"Can I create an object class with some methods implemented in C and others "
"in Python (e.g. through inheritance)?"
msgstr ""
"メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを "
"(継承などで) 作ることはできますか?"
#: ../../faq/extending.rst:442
msgid ""
"Yes, you can inherit from built-in classes such as :class:`int`, :class:"
"`list`, :class:`dict`, etc."
msgstr ""
"はい、 :class:`int` 、 :class:`list` 、 :class:`dict` などのビルトインクラス"
"から継承できます。"
#: ../../faq/extending.rst:445
msgid ""
"The Boost Python Library (BPL, http://www.boost.org/libs/python/doc/index."
"html) provides a way of doing this from C++ (i.e. you can inherit from an "
"extension class written in C++ using the BPL)."
msgstr ""
"The Boost Python Library (BPL, http://www.boost.org/libs/python/doc/index."
"html) を使えば、これを C++ からできます。 (すなわち、BPL を使って C++ で書か"
"れた拡張クラスを継承できます)."