6
6
# Translators:
7
7
# tomo, 2021
8
8
# Arihiro TAKASE, 2023
9
+ # QQ, 2024
9
10
#
10
11
#, fuzzy
11
12
msgid ""
12
13
msgstr ""
13
14
"Project-Id-Version : Python 3.13\n "
14
15
"Report-Msgid-Bugs-To : \n "
15
- "POT-Creation-Date : 2024-06-20 06:40 +0000\n "
16
+ "POT-Creation-Date : 2024-06-28 14:15 +0000\n "
16
17
"PO-Revision-Date : 2021-06-28 00:52+0000\n "
17
- "Last-Translator : Arihiro TAKASE, 2023 \n "
18
+ "Last-Translator : QQ, 2024 \n "
18
19
"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
19
20
"ja/)\n "
20
21
"MIME-Version : 1.0\n "
@@ -56,6 +57,14 @@ msgid ""
56
57
"an object, a method called, or it is multiplied by another object. These C "
57
58
"functions are called \" type methods\" ."
58
59
msgstr ""
60
+ ":term:`CPython` ランタイムは Python の全てのオブジェクトを、 Python の全ての"
61
+ "オブジェクトの \" 基底型 (base type)\" である :c:expr:`PyObject*` 型の変数と見"
62
+ "なします。 :c:type:`PyObject` 構造体自身は :term:`参照カウント <reference "
63
+ "count>` と、オブジェクトの \" 型オブジェクト\" へのポインタのみを持ちます。こ"
64
+ "こには動作が定義されています; 型オブジェクトは、例えば、ある属性があるオブ"
65
+ "ジェクトから検索されたり、メソッドが呼ばれたり、他のオブジェクトによって操作"
66
+ "されたりしたときに、どの (C) 関数がインタープリターから呼ばれるのかを決定しま"
67
+ "す。これらの C 関数は \" 型メソッド (type method)\" と呼ばれます。"
59
68
60
69
#: ../../extending/newtypes_tutorial.rst:35
61
70
msgid ""
@@ -71,6 +80,9 @@ msgid ""
71
80
"but complete, module that defines a new type named :class:`!Custom` inside a "
72
81
"C extension module :mod:`!custom`:"
73
82
msgstr ""
83
+ "この手のことは例を見たほうが早いでしょうから、以下に C 拡張モジュール :mod:`!"
84
+ "custom` にある :class:`!Custom` という名前の新しい型を定義する、最小限ながら"
85
+ "完全なモジュールをあげておきます:"
74
86
75
87
#: ../../extending/newtypes_tutorial.rst:43
76
88
msgid ""
@@ -97,19 +109,27 @@ msgid ""
97
109
"What a :class:`!Custom` **object** contains: this is the ``CustomObject`` "
98
110
"struct, which is allocated once for each :class:`!Custom` instance."
99
111
msgstr ""
112
+ ":class:`!Custom` **オブジェクト** が何を含んでいるか: これが "
113
+ "``CustomObject`` 構造体で、 :class:`!Custom` インスタンスごとに1回だけメモリ"
114
+ "確保が行われます。"
100
115
101
116
#: ../../extending/newtypes_tutorial.rst:55
102
117
msgid ""
103
118
"How the :class:`!Custom` **type** behaves: this is the ``CustomType`` "
104
119
"struct, which defines a set of flags and function pointers that the "
105
120
"interpreter inspects when specific operations are requested."
106
121
msgstr ""
122
+ ":class:`!Custom` **型** がどのように振る舞うか: これが ``CustomType`` 構造体"
123
+ "で、フラグと関数ポインタの集まりを定義しています。特定の操作が要求されたとき"
124
+ "に、この関数ポインタをインタープリターが見に行きます。"
107
125
108
126
#: ../../extending/newtypes_tutorial.rst:58
109
127
msgid ""
110
128
"How to initialize the :mod:`!custom` module: this is the ``PyInit_custom`` "
111
129
"function and the associated ``custommodule`` struct."
112
130
msgstr ""
131
+ ":mod:`!custom` モジュールをどう初期化するか: これが ``PyInit_custom`` 関数と"
132
+ "それに関係する ``custommodule`` 構造体です。"
113
133
114
134
#: ../../extending/newtypes_tutorial.rst:61
115
135
msgid "The first bit is::"
@@ -125,6 +145,13 @@ msgid ""
125
145
"abstract away the layout and to enable additional fields in :ref:`debug "
126
146
"builds <debug-build>`."
127
147
msgstr ""
148
+ "これが Custom オブジェクトの内容です。 ``PyObject_HEAD`` はそれぞれのオブジェ"
149
+ "クト構造体の先頭に必須なもので、 :c:type:`PyObject` 型の ``ob_base`` という名"
150
+ "前のフィールドを定義します。 :c:type:`PyObject` 型には (それぞれ :c:macro:"
151
+ "`Py_TYPE` マクロおよび :c:macro:`Py_REFCNT` マクロからアクセスできる) 型オブ"
152
+ "ジェクトへのポインタと参照カウントが格納されています。このマクロが用意されて"
153
+ "いる理由は、構造体のレイアウトを抽象化し、デバッグビルドでフィールドを追加で"
154
+ "きるようにするためです。"
128
155
129
156
#: ../../extending/newtypes_tutorial.rst:76
130
157
msgid ""
@@ -200,13 +227,22 @@ msgid ""
200
227
"`!custom.Custom`. Using the real dotted import path is important to make "
201
228
"your type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::"
202
229
msgstr ""
230
+ "型の名前が、モジュール名とモジュールにおける型の名前の両方をドットでつないだ"
231
+ "名前になっていることに注意してください。この場合は、モジュールは :mod:`!"
232
+ "custom` で型は :class:`!Custom` なので、型の名前を :class:`!custom.Custom` に"
233
+ "設定しました。実際のドット付きのインポートパスを使うのは、 :mod:`pydoc` モ"
234
+ "ジュールや :mod:`pickle` モジュールと互換性を持たせるために重要なのです。"
203
235
204
236
#: ../../extending/newtypes_tutorial.rst:138
205
237
msgid ""
206
238
"This is so that Python knows how much memory to allocate when creating new :"
207
239
"class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is only "
208
240
"used for variable-sized objects and should otherwise be zero."
209
241
msgstr ""
242
+ "これは、新しい :class:`!Custom` インスタンスを作るときに Python が割り当てる"
243
+ "べきメモリがどのくらいなのかを知るためのものです。 :c:member:`~PyTypeObject."
244
+ "tp_itemsize` は可変サイズのオブジェクトでのみ使うものなので、サイズが可変でな"
245
+ "いオブジェクトでは 0 にすべきです。"
210
246
211
247
#: ../../extending/newtypes_tutorial.rst:144
212
248
msgid ""
@@ -221,10 +257,19 @@ msgid ""
221
257
"type will be :class:`object`, or else you will be adding data members to "
222
258
"your base type, and therefore increasing its size."
223
259
msgstr ""
260
+ "型を Python でサブクラス化可能にしたい場合、その型が基底の型と同じ :c:member:"
261
+ "`~PyTypeObject.tp_basicsize` をもっていると、多重継承のときに問題が生じること"
262
+ "があります。その型の Python サブクラスは、 :attr:`~class.__bases__` リストの"
263
+ "最初に型がくるようにしなければなりません。さもないと、エラーの発生なしに、型"
264
+ "の :meth:`~object.__new__` メソッドを呼び出すことができなくなります。つねに型"
265
+ "の :c:member:`~PyTypeObject.tp_basicsize` をその基底型よりも大きくしておくこ"
266
+ "とで、この問題を回避することができます。ほとんどの場合、型は :class:`object` "
267
+ "か、そうでなければ基底タイプにデータ用のメンバを追加したものでしょうから、大"
268
+ "きさはつねに増加するためこの条件は満たされています。"
224
269
225
270
#: ../../extending/newtypes_tutorial.rst:154
226
271
msgid "We set the class flags to :c:macro:`Py_TPFLAGS_DEFAULT`. ::"
227
- msgstr ""
272
+ msgstr ":c:macro:`Py_TPFLAGS_DEFAULT` にクラスフラグを設定します。 :: "
228
273
229
274
#: ../../extending/newtypes_tutorial.rst:158
230
275
msgid ""
@@ -249,46 +294,65 @@ msgid ""
249
294
"the default implementation provided by the API function :c:func:"
250
295
"`PyType_GenericNew`. ::"
251
296
msgstr ""
297
+ "オブジェクトが生成できるように、 :c:member:`~PyTypeObject.tp_new` ハンドラを"
298
+ "提供する必要があります。これは Python のメソッド :meth:`~object.__new__` と同"
299
+ "等のものですが、明示的に与える必要があります。今の場合では、 API 関数の :c:"
300
+ "func:`PyType_GenericNew` として提供されるデフォルトの実装をそのまま使えま"
301
+ "す。 ::"
252
302
253
303
#: ../../extending/newtypes_tutorial.rst:173
254
304
msgid ""
255
305
"Everything else in the file should be familiar, except for some code in :c:"
256
306
"func:`!PyInit_custom`::"
257
307
msgstr ""
308
+ "ファイルの残りの部分はきっと馴染みやすいものだと思いますが、 :c:func:`!"
309
+ "PyInit_custom` の一部のコードはそうではないでしょう::"
258
310
259
311
#: ../../extending/newtypes_tutorial.rst:179
260
312
msgid ""
261
313
"This initializes the :class:`!Custom` type, filling in a number of members "
262
314
"to the appropriate default values, including :c:member:`~PyObject.ob_type` "
263
315
"that we initially set to ``NULL``. ::"
264
316
msgstr ""
317
+ "これは、 ``NULL`` に初期化された :c:member:`~PyObject.ob_type` も含めて、いく"
318
+ "つかのメンバーを適切なデフォルト値で埋めて、 :class:`!Custom` 型を初期化しま"
319
+ "す。 ::"
265
320
266
321
#: ../../extending/newtypes_tutorial.rst:188
267
322
msgid ""
268
323
"This adds the type to the module dictionary. This allows us to create :"
269
324
"class:`!Custom` instances by calling the :class:`!Custom` class:"
270
325
msgstr ""
326
+ "これは型をモジュールの辞書に追加します。こうすることで :class:`!Custom` クラ"
327
+ "スの呼び出しで :class:`!Custom` インスタンスが作成できるようになります:"
271
328
272
329
#: ../../extending/newtypes_tutorial.rst:196
273
330
msgid ""
274
331
"That's it! All that remains is to build it; put the above code in a file "
275
332
"called :file:`custom.c`,"
276
333
msgstr ""
334
+ "以上です!残りの作業はビルドだけです; :file:`custom.c` という名前のファイルに"
335
+ "ここまでのコードを書き込み、"
277
336
278
337
#: ../../extending/newtypes_tutorial.rst:201
279
338
msgid "in a file called :file:`pyproject.toml`, and"
280
- msgstr ""
339
+ msgstr ":file:`pyproject.toml` というファイルにこれを書き込み、 "
281
340
282
341
#: ../../extending/newtypes_tutorial.rst:208
283
342
msgid "in a file called :file:`setup.py`; then typing"
284
- msgstr "そして、シェルから以下のように入力します"
343
+ msgstr ""
344
+ "そして :file:`setup.py` というファイルにこのように書き込み、そして、以下のよ"
345
+ "うに"
285
346
286
347
#: ../../extending/newtypes_tutorial.rst:214
287
348
msgid ""
288
349
"in a shell should produce a file :file:`custom.so` in a subdirectory and "
289
350
"install it; now fire up Python --- you should be able to ``import custom`` "
290
351
"and play around with ``Custom`` objects."
291
352
msgstr ""
353
+ "シェルに入力します。これにより、サブディレクトリに :file:`custom.so` が生成さ"
354
+ "れ、インストールされます。これで、 Python を立ち上げて、 ``import custom`` す"
355
+ "ると ``Custom`` オブジェクトで遊べるようになっているはずです。"
292
356
293
357
#: ../../extending/newtypes_tutorial.rst:218
294
358
msgid "That wasn't so hard, was it?"
@@ -312,10 +376,13 @@ msgid ""
312
376
"make the type usable as a base class. We'll create a new module, :mod:`!"
313
377
"custom2` that adds these capabilities:"
314
378
msgstr ""
379
+ "この基本のサンプルにデータとメソッドを追加してみましょう。ついでに、この型を"
380
+ "基底クラスとしても利用できるようにします。ここでは新しいモジュール :mod:`!"
381
+ "custom2` をつくり、これらの機能を追加します:"
315
382
316
383
#: ../../extending/newtypes_tutorial.rst:234
317
384
msgid "This version of the module has a number of changes."
318
- msgstr "このバージョンでは 、いくつもの変更をおこないます。"
385
+ msgstr "モジュールのこのバージョンでは 、いくつもの変更をおこないます。"
319
386
320
387
#: ../../extending/newtypes_tutorial.rst:236
321
388
msgid ""
@@ -324,6 +391,10 @@ msgid ""
324
391
"strings containing first and last names. The *number* attribute is a C "
325
392
"integer."
326
393
msgstr ""
394
+ ":class:`!Custom` 型は そのC構造体に 3つのデータ属性 *first* 、 *last* 、およ"
395
+ "び *number* をもつようになりました。 *first* と *last* 属性はファーストネーム"
396
+ "とラストネームを格納した Python 文字列で、 *number* 属性は C言語での整数の値"
397
+ "です。"
327
398
328
399
#: ../../extending/newtypes_tutorial.rst:240
329
400
msgid "The object structure is updated accordingly::"
@@ -352,6 +423,13 @@ msgid ""
352
423
"object's type might not be :class:`!CustomType`, because the object may be "
353
424
"an instance of a subclass."
354
425
msgstr ""
426
+ "このメソッドは、まず二つのPython 属性の参照カウントをクリアします。 :c:func:"
427
+ "`Py_XDECREF` は引数が ``NULL`` のケースを正しく扱えます (これは、``tp_new`` "
428
+ "が途中で失敗した場合に起こりえます) 。このメソッドは、つぎにオブジェクトの型 "
429
+ "(``Py_TYPE(self)`` で算出します) のメンバ :c:member:`~PyTypeObject.tp_free` "
430
+ "を呼び出し、オブジェクトのメモリを開放します。オブジェクトの型が :class:`!"
431
+ "CustomType` であるとは限らない点に注意してください。なぜなら、オブジェクトは"
432
+ "サブクラスのインスタンスかもしれないからです。"
355
433
356
434
#: ../../extending/newtypes_tutorial.rst:273
357
435
msgid ""
@@ -365,7 +443,7 @@ msgstr ""
365
443
"``Custom_dealloc`` が ``CustomObject *`` 引数をとると定義しましたが、 "
366
444
"``tp_dealloc`` 関数のポインタは ``PyObject *`` 引数を受け取ることになっている"
367
445
"からです。もし明示的に型変換をしなければ、コンパイラが警告を発するでしょう。"
368
- "これは、Cにおけるオブジェクト指向のポリモーフィズムです !"
446
+ "これは、 C におけるオブジェクト指向のポリモーフィズムです !"
369
447
370
448
#: ../../extending/newtypes_tutorial.rst:279
371
449
msgid ""
@@ -423,6 +501,9 @@ msgid ""
423
501
"Since memory allocation may fail, we must check the :c:member:`~PyTypeObject."
424
502
"tp_alloc` result against ``NULL`` before proceeding."
425
503
msgstr ""
504
+ "メモリ割り当ては失敗するかもしれないので、先に進む前に :c:member:"
505
+ "`~PyTypeObject.tp_alloc` の結果が ``NULL`` でないかチェックしなければなりませ"
506
+ "ん。"
426
507
427
508
#: ../../extending/newtypes_tutorial.rst:335
428
509
msgid ""
@@ -444,6 +525,15 @@ msgid ""
444
525
"correctly. (Specifically, you may not be able to create instances of such "
445
526
"subclasses without getting a :exc:`TypeError`.)"
446
527
msgstr ""
528
+ "もし協力的な :c:member:`~PyTypeObject.tp_new` (基底タイプの :c:member:"
529
+ "`~PyTypeObject.tp_new` または :meth:`~object.__new__` を呼んでいるもの) を作"
530
+ "りたいのならば、実行時のメソッド解決順序をつかってどのメソッドを呼びだすかを"
531
+ "決定しようとしては *いけません* 。常に呼び出す型を静的に決めておき、直接そ"
532
+ "の :c:member:`~PyTypeObject.tp_new` を呼び出すか、あるいは ``type->tp_base-"
533
+ ">tp_new`` を経由してください。こうしないと、あなたが作成したタイプの Python "
534
+ "サブクラスが他の Python で定義されたクラスも継承している場合にうまく動かない"
535
+ "場合があります。 (とりわけ、そのようなサブクラスのインスタンスを :exc:"
536
+ "`TypeError` を出さずに作ることが不可能になります。)"
447
537
448
538
#: ../../extending/newtypes_tutorial.rst:351
449
539
msgid ""
0 commit comments