@@ -47,28 +47,33 @@ msgstr ""
4747
4848#: ../../library/devmode.rst:19
4949msgid "Effects of the Python Development Mode"
50- msgstr ""
50+ msgstr "Python 開発モードの影響 "
5151
5252#: ../../library/devmode.rst:21
5353msgid ""
5454"Enabling the Python Development Mode is similar to the following command, "
5555"but with additional effects described below::"
5656msgstr ""
57+ "Python 開発モードを有効化することは次のコマンドに似ていますが、以下で説明され"
58+ "る追加の影響があります::"
5759
5860#: ../../library/devmode.rst:24
5961msgid ""
6062"PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler"
6163msgstr ""
64+ "PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler"
6265
6366#: ../../library/devmode.rst:26
6467msgid "Effects of the Python Development Mode:"
65- msgstr ""
68+ msgstr "Python 開発モードの影響: "
6669
6770#: ../../library/devmode.rst:28
6871msgid ""
6972"Add ``default`` :ref:`warning filter <describing-warning-filters>`. The "
7073"following warnings are shown:"
7174msgstr ""
75+ "``default`` の :ref:`警告フィルタ <describing-warning-filters>` を追加しま"
76+ "す。次の警告が表示されます:"
7277
7378#: ../../library/devmode.rst:31
7479msgid ":exc:`DeprecationWarning`"
@@ -91,6 +96,8 @@ msgid ""
9196"Normally, the above warnings are filtered by the default :ref:`warning "
9297"filters <describing-warning-filters>`."
9398msgstr ""
99+ "通常、上記の警告は デフォルトの :ref:`警告フィルタ <describing-warning-"
100+ "filters>` によりフィルタリングされます。"
94101
95102#: ../../library/devmode.rst:39
96103msgid ""
@@ -228,7 +235,7 @@ msgstr ""
228235
229236#: ../../library/devmode.rst:111
230237msgid "ResourceWarning Example"
231- msgstr ""
238+ msgstr "ResourceWarning の例 "
232239
233240#: ../../library/devmode.rst:113
234241msgid ""
@@ -249,6 +256,16 @@ msgid ""
249256"if __name__ == \" __main__\" :\n"
250257" main()"
251258msgstr ""
259+ "import sys\n"
260+ "\n"
261+ "def main():\n"
262+ " fp = open(sys.argv[1])\n"
263+ " nlines = len(fp.readlines())\n"
264+ " print(nlines)\n"
265+ " # ファイルは暗黙的に閉じられる\n"
266+ "\n"
267+ "if __name__ == \" __main__\" :\n"
268+ " main()"
252269
253270#: ../../library/devmode.rst:127
254271msgid ""
@@ -261,6 +278,8 @@ msgid ""
261278"$ python script.py README.txt\n"
262279"269"
263280msgstr ""
281+ "$ python script.py README.txt\n"
282+ "269"
264283
265284#: ../../library/devmode.rst:135
266285msgid ""
@@ -277,6 +296,12 @@ msgid ""
277296" main()\n"
278297"ResourceWarning: Enable tracemalloc to get the object allocation traceback"
279298msgstr ""
299+ "$ python -X dev script.py README.txt\n"
300+ "269\n"
301+ "script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README."
302+ "rst' mode='r' encoding='UTF-8'>\n"
303+ " main()\n"
304+ "ResourceWarning: Enable tracemalloc to get the object allocation traceback"
280305
281306#: ../../library/devmode.rst:145
282307msgid ""
@@ -297,6 +322,16 @@ msgid ""
297322" File \" script.py\" , lineno 4\n"
298323" fp = open(sys.argv[1])"
299324msgstr ""
325+ "$ python -X dev -X tracemalloc=5 script.py README.rst\n"
326+ "269\n"
327+ "script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README."
328+ "rst' mode='r' encoding='UTF-8'>\n"
329+ " main()\n"
330+ "Object allocated at (most recent call last):\n"
331+ " File \" script.py\" , lineno 10\n"
332+ " main()\n"
333+ " File \" script.py\" , lineno 4\n"
334+ " fp = open(sys.argv[1])"
300335
301336#: ../../library/devmode.rst:160
302337msgid ""
@@ -311,6 +346,11 @@ msgid ""
311346" nlines = len(fp.readlines())\n"
312347" print(nlines)"
313348msgstr ""
349+ "def main():\n"
350+ " # ブロックを終了する際に明示的にファイルを閉じる\n"
351+ " with open(sys.argv[1]) as fp:\n"
352+ " nlines = len(fp.readlines())\n"
353+ " print(nlines)"
314354
315355#: ../../library/devmode.rst:168
316356msgid ""
@@ -341,6 +381,16 @@ msgid ""
341381"\n"
342382"main()"
343383msgstr ""
384+ "import os\n"
385+ "\n"
386+ "def main():\n"
387+ " fp = open(__file__)\n"
388+ " firstline = fp.readline()\n"
389+ " print(firstline.rstrip())\n"
390+ " os.close(fp.fileno())\n"
391+ " # ファイルは暗黙的に閉じられる\n"
392+ "\n"
393+ "main()"
344394
345395#: ../../library/devmode.rst:190
346396msgid "By default, Python does not emit any warning:"
@@ -351,6 +401,8 @@ msgid ""
351401"$ python script.py\n"
352402"import os"
353403msgstr ""
404+ "$ python script.py\n"
405+ "import os"
354406
355407#: ../../library/devmode.rst:197
356408msgid ""
@@ -373,6 +425,18 @@ msgid ""
373425" main()\n"
374426"OSError: [Errno 9] Bad file descriptor"
375427msgstr ""
428+ "$ python -X dev script.py\n"
429+ "import os\n"
430+ "script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='script."
431+ "py' mode='r' encoding='UTF-8'>\n"
432+ " main()\n"
433+ "ResourceWarning: Enable tracemalloc to get the object allocation traceback\n"
434+ "Exception ignored in: <_io.TextIOWrapper name='script.py' mode='r' "
435+ "encoding='UTF-8'>\n"
436+ "Traceback (most recent call last):\n"
437+ " File \" script.py\" , line 10, in <module>\n"
438+ " main()\n"
439+ "OSError: [Errno 9] Bad file descriptor"
376440
377441#: ../../library/devmode.rst:213
378442msgid ""
0 commit comments