Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd8947e

Browse files
author
github-actions
committed
Merge 3.11 into 3.10
1 parentd8fb255 commitcd8947e

File tree

12 files changed

+276
-8
lines changed

12 files changed

+276
-8
lines changed

‎c-api/exceptions.po

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ msgid ""
3838
"pointer, or ``-1`` if they return an integer (exception: the ``PyArg_*`` "
3939
"functions return ``1`` for success and ``0`` for failure)."
4040
msgstr""
41+
"この章で説明する関数を使うと、 Python の例外の処理や例外の送出ができるように"
42+
"なります。 Python の例外処理の基本をいくらか理解することが大切です。例外は "
43+
"POSIX :c:data:`errno` 変数にやや似た機能を果たします: 発生した中で最も新しい"
44+
"エラーの (スレッド毎の) グローバルなインジケータがあります。実行に成功した場"
45+
"合にはほとんどの C API 関数がこれをクリアしませんが、失敗したときにはエラーの"
46+
"原因を示すために設定します。ほとんどの C API 関数はエラーインジケータも返し、"
47+
"通常は関数がポインタを返すことになっている場合は ``NULL`` であり、関数が整数"
48+
"を返す場合は ``-1`` です。(例外: ``PyArg_*`` 関数は実行に成功したときに "
49+
"``1`` を返し、失敗したときに ``0`` を返します)."
4150

4251
#:../../c-api/exceptions.rst:20
4352
msgid""
@@ -106,6 +115,11 @@ msgid ""
106115
"printed and the Python process will exit with the error code specified by "
107116
"the ``SystemExit`` instance."
108117
msgstr""
118+
"標準のトレースバックを ``sys.stderr`` に出力し、エラーインジケータをクリアし"
119+
"ます。\n"
120+
"ただし、エラーが ``SystemExit`` **である場合を除いて** です。\n"
121+
"その場合、トレースバックは出力されず、 Python プロセスは ``SystemExit`` イン"
122+
"スタンスで指定されたエラーコードで終了します。"
109123

110124
#:../../c-api/exceptions.rst:60
111125
msgid""
@@ -183,6 +197,10 @@ msgid ""
183197
"count. The second argument is an error message; it is decoded from "
184198
"``'utf-8'``."
185199
msgstr""
200+
"これはエラーインジケータを設定するための最も一般的な方法です。第一引数は例外"
201+
"の型を指定します。通常は標準例外の一つ、例えば :c:data:`PyExc_RuntimeError` "
202+
"です。その参照カウントを増加させる必要はありません。第二引数はエラーメッセー"
203+
"ジで、 ``'utf-8'`` からデコードされます。"
186204

187205
#:../../c-api/exceptions.rst:108
188206
msgid""
@@ -289,6 +307,10 @@ msgid ""
289307
"is given as a C string. *filename* is decoded from the :term:`filesystem "
290308
"encoding and error handler`."
291309
msgstr""
310+
":c:func:`PyErr_SetFromErrnoWithFilenameObject` に似ていますが、ファイル名は "
311+
"C 文字列として与えられます。\n"
312+
"*filename* は :term:`ファイルシステムのエンコーディングとエラーハンドラ "
313+
"<filesystem encoding and error handler>` でデコードされます。"
292314

293315
#:../../c-api/exceptions.rst:191
294316
msgid""
@@ -302,6 +324,14 @@ msgid ""
302324
"``PyErr_SetObject(PyExc_WindowsError, object)``. This function always "
303325
"returns ``NULL``."
304326
msgstr""
327+
"これは :exc:`WindowsError` を発生させるために便利な関数です。 ``0`` の "
328+
"*ierr* とともに呼び出された場合、 :c:func:`GetLastError` が返すエラーコードが"
329+
"代りに使われます。 *ierr* あるいは :c:func:`GetLastError` によって与えられる"
330+
"エラーコードのWindows用の説明を取り出すために、Win32関数 :c:func:"
331+
"`FormatMessage` を呼び出します。それから、第一要素が *ierr* 値で第二要素が(:"
332+
"c:func:`FormatMessage` から得られる) 対応するエラーメッセージであるタプルオブ"
333+
"ジェクトを構成します。そして、 ``PyErr_SetObject(PyExc_WindowsError, "
334+
"object)`` を呼び出します。この関数は常に ``NULL`` を返します。"
305335

306336
#:../../c-api/exceptions.rst:200../../c-api/exceptions.rst:208
307337
#:../../c-api/exceptions.rst:217../../c-api/exceptions.rst:225
@@ -388,12 +418,17 @@ msgid ""
388418
"Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string "
389419
"decoded from the :term:`filesystem encoding and error handler`."
390420
msgstr""
421+
":c:func:`PyErr_SyntaxLocationObject` と似ていますが、 *filename* は :term:`"
422+
"ファイルシステムのエンコーディングとエラーハンドラ <filesystem encoding and "
423+
"error handler>` でデコードされたバイト文字列です。"
391424

392425
#:../../c-api/exceptions.rst:284
393426
msgid""
394427
"Like :c:func:`PyErr_SyntaxLocationEx`, but the *col_offset* parameter is "
395428
"omitted."
396429
msgstr""
430+
":c:func:`PyErr_SyntaxLocationEx` と似ていますが、 *col_offset* 引数が除去され"
431+
"ています。"
397432

398433
#:../../c-api/exceptions.rst:290
399434
msgid""
@@ -486,13 +521,21 @@ msgid ""
486521
"warn_explicit`; see there for more information. The *module* and *registry* "
487522
"arguments may be set to ``NULL`` to get the default effect described there."
488523
msgstr""
524+
"すべての警告の属性を明示的に制御した警告メッセージを出します。これは Python "
525+
"関数 :func:`warnings.warn_explicit` の直接的なラッパーで、さらに情報を得るに"
526+
"はそちらを参照してください。そこに説明されているデフォルトの効果を得るため"
527+
"に、 *module* と *registry* 引数は ``NULL`` に設定することができます。"
489528

490529
#:../../c-api/exceptions.rst:345
491530
msgid""
492531
"Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and "
493532
"*module* are UTF-8 encoded strings, and *filename* is decoded from the :term:"
494533
"`filesystem encoding and error handler`."
495534
msgstr""
535+
":c:func:`PyErr_WarnExplicitObject` に似ていますが、 *message* と *module* が "
536+
"UTF-8 エンコードされた文字列であるところが異なり、 *filename* は :term:`ファ"
537+
"イルシステムのエンコーディングとエラーハンドラ <filesystem encoding and "
538+
"error handler>` でデコードされます。"
496539

497540
#:../../c-api/exceptions.rst:352
498541
msgid""
@@ -525,6 +568,11 @@ msgid ""
525568
"do not own a reference to the return value, so you do not need to :c:func:"
526569
"`Py_DECREF` it."
527570
msgstr""
571+
"エラーインジケータが設定されているかテストします。設定されている場合は、例外"
572+
"の *型* (``PyErr_Set*`` 関数の一つあるいは :c:func:`PyErr_Restore` への最も新"
573+
"しい呼び出しに対する第一引数)を返します。設定されていない場合は ``NULL`` を返"
574+
"します。あなたは戻り値への参照を持っていませんので、それに :c:func:"
575+
"`Py_DECREF` する必要はありません。"
528576

529577
#:../../c-api/exceptions.rst:378
530578
msgid"The caller must hold the GIL."
@@ -762,6 +810,9 @@ msgid ""
762810
"`PyErr_CheckSignals` is called, the Python signal handler for the given "
763811
"signal number will be called."
764812
msgstr""
813+
"シグナルが到達した効果をシミュレートします。\n"
814+
"次に :c:func:`PyErr_CheckSignals` が呼ばれたとき、与えられたシグナル番号用の "
815+
"Python のシグナルハンドラが呼び出されます。"
765816

766817
#:../../c-api/exceptions.rst:558
767818
msgid""
@@ -776,6 +827,8 @@ msgid ""
776827
"If the given signal isn't handled by Python (it was set to :data:`signal."
777828
"SIG_DFL` or :data:`signal.SIG_IGN`), it will be ignored."
778829
msgstr""
830+
"与えられたシグナルが Python に対処されなかった (:data:`signal.SIG_DFL` また"
831+
"は :data:`signal.SIG_IGN` に設定されていた) 場合、無視されます。"
779832

780833
#:../../c-api/exceptions.rst:566
781834
msgid""
@@ -1085,6 +1138,9 @@ msgid ""
10851138
"to be concatenated to the :exc:`RecursionError` message caused by the "
10861139
"recursion depth limit."
10871140
msgstr""
1141+
"*where* は ``\" in instance check\"`` のような UTF-8 エンコードされた文字列に"
1142+
"して、再帰の深さの限界に達したことで送出される :exc:`RecursionError` のメッ"
1143+
"セージに連結できるようにすべきです。"
10881144

10891145
#:../../c-api/exceptions.rst:783../../c-api/exceptions.rst:791
10901146
msgid"This function is now also available in the limited API."
@@ -1169,6 +1225,9 @@ msgid ""
11691225
"c:expr:`PyObject*`; they are all class objects. For completeness, here are "
11701226
"all the variables:"
11711227
msgstr""
1228+
"``PyExc_`` の後ろにPythonの例外名が続く名前をもつグローバル変数として、すべて"
1229+
"の標準Python例外が利用可能です。これらは型 :c:expr:`PyObject*` を持ち、すべて"
1230+
"クラスオブジェクトです。完璧を期するために、すべての変数を以下に列挙します:"
11721231

11731232
#:../../c-api/exceptions.rst:890../../c-api/exceptions.rst:1023
11741233
#:../../c-api/exceptions.rst:1068
@@ -1694,6 +1753,10 @@ msgid ""
16941753
"the type :c:expr:`PyObject*`; they are all class objects. For completeness, "
16951754
"here are all the variables:"
16961755
msgstr""
1756+
"``PyExc_`` の後ろにPythonの例外名が続く名前をもつグローバル変数として、すべて"
1757+
"の標準Python警告カテゴリが利用可能です。これらは型 :c:expr:`PyObject*` を持"
1758+
"ち、すべてクラスオブジェクトです。完璧を期するために、すべての変数を以下に列"
1759+
"挙します:"
16971760

16981761
#:../../c-api/exceptions.rst:1070
16991762
msgid":c:data:`PyExc_Warning`"

‎c-api/intro.po

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,16 @@ msgid ""
357357
"never be deallocated, they are typically static :c:type:`PyTypeObject` "
358358
"objects."
359359
msgstr""
360+
"Python/C API 関数は、 :c:expr:`PyObject*` 型の一つ以上の引数と戻り値を持ちま"
361+
"す。この型は、任意の Python オブジェクトを表現する不透明 (opaque) なデータ型"
362+
"へのポインタです。 Python 言語は、全ての Python オブジェクト型をほとんどの状"
363+
"況 (例えば代入、スコープ規則 (scope rule)、引数渡し) で同様に扱います。ほとん"
364+
"ど全ての Python オブジェクトはヒープ (heap) 上に置かれます: このため、 :c:"
365+
"type:`PyObject` 型のオブジェクトは、自動記憶 (automatic) としても静的記憶 "
366+
"(static) としても宣言できません。 :c:expr:`PyObject*` 型のポインタ変数のみ宣"
367+
"言できます。唯一の例外は、型オブジェクトです; 型オブジェクトはメモリ解放 "
368+
"(deallocate) してはならないので、通常は静的記憶の :c:type:`PyTypeObject` オブ"
369+
"ジェクトにします。"
360370

361371
#:../../c-api/intro.rst:242
362372
msgid""
@@ -519,6 +529,18 @@ msgid ""
519529
"said to *borrow* the reference. Nothing needs to be done for a :term:"
520530
"`borrowed reference`."
521531
msgstr""
532+
"Python/C API の各関数における参照カウントの振る舞いは、説明するには、 *参照の"
533+
"所有権 (ownership of references)* という言葉でうまく説明できます。所有権は参"
534+
"照に対するもので、オブジェクトに対するものではありません (オブジェクトは誰に"
535+
"も所有されず、常に共有されています)。ある\"参照の所有\" は、その参照が必要な"
536+
"くなった時点で Py_DECREF を呼び出す役割を担うことを意味します。所有権は委譲で"
537+
"き、あるコードが委譲によって所有権を得ると、今度はそのコードが参照が必要なく"
538+
"なった際に最終的に :c:func:`Py_DECREF` や :c:func:`Py_XDECREF` を呼び出して、"
539+
"参照カウンタを1つ減らす役割を担います --- あるいは、その役割を (通常はコード"
540+
"を呼び出した元に) 受け渡します。ある関数が、関数の呼び出し側に対して参照の所"
541+
"有権を渡すと、呼び出し側は *新たな* 参照 (new reference) を得る、と言います。"
542+
"所有権が渡されない場合、呼び出し側は参照を *借りる* (borrow) といいます。:"
543+
"term:`借りた参照 <borrowed reference>` に対しては、何もする必要はありません。"
522544

523545
#:../../c-api/intro.rst:331
524546
msgid""
@@ -680,6 +702,12 @@ msgid ""
680702
"of a complex number. These will be discussed together with the functions "
681703
"that use them."
682704
msgstr""
705+
"他にも Python/C API において重要な役割を持つデータ型がいくつかあります; ほと"
706+
"んどは :c:expr:`int`, :c:expr:`long`, :c:expr:`double`, および :c:expr:"
707+
"`char*` といった、単なる C のデータ型です。また、モジュールで公開している関数"
708+
"を列挙する際に用いられる静的なテーブルや、新しいオブジェクト型におけるデータ"
709+
"属性を記述したり、複素数の値を記述したりするために構造体をいくつか使っていま"
710+
"す。これらの型については、その型を使う関数とともに説明してゆきます。"
683711

684712
#:../../c-api/intro.rst:507
685713
msgid""
@@ -1006,6 +1034,11 @@ msgid ""
10061034
"most frequently used builds will be described in the remainder of this "
10071035
"section."
10081036
msgstr""
1037+
"Pythonデバッグ版ビルドの全ての種類のリストが、Pythonソース配布(source "
1038+
"distribution)の中の :file:`Misc/SpecialBuilds.txt` にあります。参照カウントの"
1039+
"トレース、メモリアロケータのデバッグ、インタプリタのメインループの低レベルプ"
1040+
"ロファイリングが利用可能です。よく使われるビルドについてのみ、この節の残りの"
1041+
"部分で説明します。"
10091042

10101043
#:../../c-api/intro.rst:751
10111044
msgid""
@@ -1017,6 +1050,12 @@ msgid ""
10171050
"macro:`Py_DEBUG` is enabled in the Unix build, compiler optimization is "
10181051
"disabled."
10191052
msgstr""
1053+
"インタプリタを :c:macro:`Py_DEBUG` マクロを有効にしてコンパイルすると、一般的"
1054+
"に :ref:`デバッグビルドといわれる Python <debug-build>` ができます。 Unix で"
1055+
"は、 :file:`./configure` コマンドに :option:`--with-pydebug` を追加すること"
1056+
"で、 :c:macro:`Py_DEBUG` が有効になります。その場合、暗黙的にPython専用ではな"
1057+
"い :c:macro:`_DEBUG` も有効になります。 Unix ビルドでは、 :c:macro:"
1058+
"`Py_DEBUG` が有効な場合、コンパイラの最適化が無効になります。"
10201059

10211060
#:../../c-api/intro.rst:759
10221061
msgid""
@@ -1033,6 +1072,12 @@ msgid ""
10331072
"well. Upon exit, all existing references are printed. (In interactive mode "
10341073
"this happens after every statement run by the interpreter.)"
10351074
msgstr""
1075+
":c:macro:`Py_TRACE_REFS` を宣言すると、参照トレースが有効になります (:option:"
1076+
"`configure --with-trace-refs オプション <--with-trace-refs>` を参照してくださ"
1077+
"い)。全ての :c:type:`PyObject` に二つのフィールドを追加することで、使用中のオ"
1078+
"ブジェクトの循環二重連結リストが管理されます。全ての割り当て(allocation)がト"
1079+
"レースされます。終了時に、全ての残っているオブジェクトが表示されます。 (イン"
1080+
"タラクティブモードでは、インタプリタによる文の実行のたびに表示されます。)"
10361081

10371082
#:../../c-api/intro.rst:769
10381083
msgid""

‎c-api/refcounting.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ msgid ""
4949
"The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, "
5050
"use :c:func:`Py_XINCREF`."
5151
msgstr""
52+
"オブジェクトが ``NULL`` であってはいけません。それが ``NULL`` ではないと確信"
53+
"が持てないならば、 :c:func:`Py_XINCREF` を使ってください。"
5254

5355
#:../../c-api/refcounting.rst:28
5456
msgid""
@@ -122,6 +124,8 @@ msgid ""
122124
"The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, "
123125
"use :c:func:`Py_XDECREF`."
124126
msgstr""
127+
"オブジェクトが ``NULL`` であってはいけません。それが ``NULL`` ではないと確信"
128+
"が持てないならば、 :c:func:`Py_XDECREF` を使ってください。"
125129

126130
#:../../c-api/refcounting.rst:83
127131
msgid""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp